CaiWuXiTong/app/Models/Business/CourierQuoteChangeEvent.php

40 lines
1.0 KiB
PHP

<?php
namespace App\Models\Business;
use App\Abstracts\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
class CourierQuoteChangeEvent extends Model
{
protected $table = 'business_courier_quote_change_events';
protected $fillable = [
'company_id', 'quote_change_id', 'event_type', 'from_status', 'to_status', 'note', 'details_json', 'created_by',
];
protected $casts = ['company_id' => 'integer'];
public function change(): BelongsTo
{
return $this->belongsTo(CourierQuoteChange::class, 'quote_change_id');
}
public function actor(): BelongsTo
{
return $this->belongsTo(user_model_class(), 'created_by');
}
public function eventLabel(): string
{
return match ($this->event_type) {
'created' => '创建草稿',
'saved' => '保存草稿',
'submitted' => '提交审核',
'returned' => '退回修改',
'approved' => '审核通过',
default => $this->event_type,
};
}
}