Files
dafuweng/addons/webman/model/Slider.php
2026-03-02 13:44:38 +08:00

47 lines
1.3 KiB
PHP

<?php
namespace addons\webman\model;
use addons\webman\traits\DataPermissions;
use addons\webman\traits\HasDateTimeFormatter;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\SoftDeletes;
/**
* Class Slider
* @property int id 主键
* @property int department_id 部门/渠道id
* @property int type 类型
* @property string name 名称
* @property string picture_url 图片地址
* @property int status 状态
* @property int sort 排序
* @property string created_at 创建时间
* @property string updated_at 最后一次修改时间
* @property string deleted_at 删除时间
* @property Channel channel 渠道
* @package addons\webman\model
*/
class Slider extends Model
{
use SoftDeletes, HasDateTimeFormatter, DataPermissions;
//数据权限字段
protected $dataAuth = ['department_id'=>'department_id'];
public function __construct(array $attributes = [])
{
parent::__construct($attributes);
$this->setTable(plugin()->webman->config('database.slider_table'));
}
/**
* 渠道信息
* @return BelongsTo
*/
public function channel(): BelongsTo
{
return $this->belongsTo(plugin()->webman->config('database.channel_model'), 'department_id', 'department_id')->withTrashed();
}
}