CaiWuXiTong/app/Models/Business/CourierSurchargeQuote.php

53 lines
1.1 KiB
PHP

<?php
namespace App\Models\Business;
use App\Abstracts\Model;
class CourierSurchargeQuote extends Model
{
public const STATUS_ACTIVE = 'active';
public const STATUS_INACTIVE = 'inactive';
protected $table = 'business_courier_surcharge_quotes';
protected $fillable = [
'company_id',
'courier',
'scope',
'reconciler',
'supplier',
'types',
'mode',
'standard',
'condition',
'effective_at',
'status',
'remark',
'created_by',
'updated_by',
];
protected $casts = [
'company_id' => 'integer',
'types' => 'array',
'effective_at' => 'date:Y-m-d',
'created_by' => 'integer',
'updated_by' => 'integer',
];
public function statusLabel(): string
{
return $this->status === self::STATUS_ACTIVE ? '已启用' : '已停用';
}
public function typeLabel(): string
{
return implode('、', array_values(array_filter(array_map(
static fn ($type): string => trim((string) $type),
(array) $this->types,
))));
}
}