41 lines
700 B
PHP
41 lines
700 B
PHP
<?php
|
|
|
|
namespace Modules\SystemTool\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\HasOne;
|
|
|
|
/**
|
|
* 首页轮播图模型
|
|
*/
|
|
class SysCarouselModel extends Model
|
|
{
|
|
protected $table = 'sys_carousel';
|
|
|
|
protected $casts = [
|
|
'status' => 'int',
|
|
'sort' => 'int',
|
|
'image_id' => 'array',
|
|
];
|
|
|
|
protected $fillable = [
|
|
'title',
|
|
'image_id',
|
|
'link',
|
|
'status',
|
|
'sort',
|
|
];
|
|
|
|
protected $with = ['image'];
|
|
|
|
/**
|
|
* 关联图片
|
|
* @return HasOne
|
|
*/
|
|
public function image(): HasOne
|
|
{
|
|
return $this->hasOne(SysFileModel::class, 'id', 'image_id');
|
|
}
|
|
|
|
}
|