42 lines
1.3 KiB
PHP
42 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
/**
|
|
* App\Models\ExpressFee
|
|
*
|
|
* @property int $id
|
|
* @property string $base_express_fee 基础运费
|
|
* @property string $free_express_fee 免运费门槛
|
|
* @property int $is_default 是否默认
|
|
* @property \Illuminate\Support\Carbon|null $created_at
|
|
* @property \Illuminate\Support\Carbon|null $updated_at
|
|
* @property-read string $created_at_format 创建时间的格式化
|
|
* @property-read string $status_string 状态名称
|
|
* @property-read string $updated_at_format 更新时间的格式化
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ExpressFee newModelQuery()
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ExpressFee newQuery()
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ExpressFee query()
|
|
* @mixin \Eloquent
|
|
*/
|
|
class ExpressFee extends BaseModel
|
|
{
|
|
public const IS_DEFAULT_FALSE = 0;
|
|
public const IS_DEFAULT_TRUE = 1;
|
|
public const IS_DEFAULT = [
|
|
self::IS_DEFAULT_FALSE => '未使用',
|
|
self::IS_DEFAULT_TRUE => '使用中',
|
|
];
|
|
|
|
/**
|
|
* 获取默认运费模板
|
|
* @return static|null
|
|
*/
|
|
public static function getDefaultExpressFee(): ?self
|
|
{
|
|
return self::where('is_default', self::IS_DEFAULT_TRUE)
|
|
->select(['base_express_fee', 'free_express_fee'])
|
|
->first();
|
|
}
|
|
}
|