34 lines
626 B
PHP
34 lines
626 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use App\Enums\DealerLvl;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class DealerChannelSubsidyLog extends Model
|
|
{
|
|
protected $casts = [
|
|
'lvl' => DealerLvl::class,
|
|
'order_completed_at' => 'datetime',
|
|
];
|
|
|
|
protected $fillable = [
|
|
'user_id',
|
|
'order_id',
|
|
'lvl',
|
|
'total_amount',
|
|
'order_completed_at',
|
|
'remark',
|
|
];
|
|
|
|
public function earning()
|
|
{
|
|
return $this->morphOne(DealerEarning::class, 'earningable');
|
|
}
|
|
|
|
public function user()
|
|
{
|
|
return $this->belongsTo(User::class, 'user_id');
|
|
}
|
|
}
|