后台退换货管理
This commit is contained in:
parent
f355a7c22c
commit
c9e0822075
|
|
@ -43,6 +43,11 @@ class RmaController extends Controller
|
|||
return view('admin::pages.rmas.info', $data);
|
||||
}
|
||||
|
||||
public function addHistory(Request $request, int $id)
|
||||
{
|
||||
RmaRepo::addHistory($id, $request->only('status', 'notify', 'comment'));
|
||||
}
|
||||
|
||||
public function destroy(int $id): array
|
||||
{
|
||||
RmaRepo::delete($id);
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ namespace Beike\Models;
|
|||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
|
||||
class Rma extends Base
|
||||
{
|
||||
|
|
@ -39,4 +40,9 @@ class Rma extends Base
|
|||
{
|
||||
return $this->belongsTo(RmaReason::class);
|
||||
}
|
||||
|
||||
public function histories() :HasMany
|
||||
{
|
||||
return $this->hasMany(RmaHistory::class);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,22 @@
|
|||
<?php
|
||||
/**
|
||||
* RmaHistory.php
|
||||
*
|
||||
* @copyright 2022 opencart.cn - All Rights Reserved
|
||||
* @link http://www.guangdawangluo.com
|
||||
* @author TL <mengwb@opencart.cn>
|
||||
* @created 2022-08-03 15:22:18
|
||||
* @modified 2022-08-03 15:22:18
|
||||
*/
|
||||
|
||||
namespace Beike\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
|
||||
class RmaHistory extends Base
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable = ['rma_id', 'status', 'notify', 'comment'];
|
||||
}
|
||||
|
||||
|
|
@ -60,6 +60,20 @@ class RmaRepo
|
|||
return Rma::query()->find($id);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $rma
|
||||
* @param array $data
|
||||
* @return Rma
|
||||
*/
|
||||
public static function addHistory($rma, Array $data)
|
||||
{
|
||||
if (!$rma instanceof Rma) {
|
||||
$rma = self::find($rma);
|
||||
}
|
||||
$rma->histories()->create($data);
|
||||
return $rma;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $id
|
||||
* @return void
|
||||
|
|
|
|||
Loading…
Reference in New Issue