51 lines
965 B
PHP
51 lines
965 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use App\Enums\DealerLvl;
|
|
use Dcat\Admin\Traits\HasDateTimeFormatter;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
/**
|
|
* 管理者的团队的商品销售业绩
|
|
*/
|
|
class DealerManagerSalesLog extends Model
|
|
{
|
|
use HasDateTimeFormatter;
|
|
|
|
protected $casts = [
|
|
'lvl' => DealerLvl::class,
|
|
'order_completed_at' => 'datetime',
|
|
];
|
|
|
|
protected $fillable = [
|
|
'user_id',
|
|
'order_id',
|
|
'product_id',
|
|
'lvl',
|
|
'sales_volume',
|
|
'order_completed_at',
|
|
];
|
|
|
|
public function user()
|
|
{
|
|
return $this->belongsTo(User::class, 'user_id');
|
|
}
|
|
|
|
/**
|
|
* 此津贴所属订单
|
|
*/
|
|
public function order()
|
|
{
|
|
return $this->belongsTo(DealerOrder::class, 'order_id');
|
|
}
|
|
|
|
/**
|
|
* 此商品销售业绩所属的商品
|
|
*/
|
|
public function product()
|
|
{
|
|
return $this->belongsTo(DealerProduct::class, 'product_id');
|
|
}
|
|
}
|