Files
xin-procurement/app/Models/HomeSpecialModel.php
T
2026-08-31 22:21:59 +08:00

43 lines
900 B
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
/**
* 小程序首页特价推荐商品
*/
class HomeSpecialModel extends Model
{
/** 状态:停用 */
public const int STATUS_DISABLED = 0;
/** 状态:正常 */
public const int STATUS_NORMAL = 1;
protected $table = 'mini_home_special';
protected $primaryKey = 'id';
protected $fillable = [
'product_id',
'sort',
'status',
];
protected $casts = [
'product_id' => 'integer',
'sort' => 'integer',
'status' => 'integer',
'created_at' => 'datetime:Y-m-d H:i:s',
'updated_at' => 'datetime:Y-m-d H:i:s',
];
/**
* 关联商品
*/
public function product(): BelongsTo
{
return $this->belongsTo(ProductModel::class, 'product_id');
}
}