61 lines
1.6 KiB
PHP
61 lines
1.6 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;
|
|
|
|
/**
|
|
* Class AnnouncementContent
|
|
* @property int id 主键
|
|
* @property int department_id 渠道id
|
|
* @property int announcement_id 公告id
|
|
* @property string title 标题
|
|
* @property string lang 语言标识
|
|
* @property string content 内容
|
|
* @property string created_at 创建时间
|
|
* @property string updated_at 最后一次修改时间
|
|
*
|
|
* @property Channel channel 渠道
|
|
* @property Announcement announcement 公告
|
|
* @package addons\webman\model
|
|
*/
|
|
class AnnouncementContent extends Model
|
|
{
|
|
use DataPermissions, HasDateTimeFormatter;
|
|
|
|
//数据权限字段
|
|
protected $dataAuth = ['department_id' => 'department_id'];
|
|
|
|
protected $fillable = [
|
|
'content', 'title', 'lang', 'announcement_id', 'department_id',
|
|
];
|
|
|
|
public function __construct(array $attributes = [])
|
|
{
|
|
parent::__construct($attributes);
|
|
$this->setTable(plugin()->webman->config('database.announcement_content_table'));
|
|
}
|
|
|
|
|
|
/**
|
|
* 渠道信息
|
|
* @return BelongsTo
|
|
*/
|
|
public function channel(): BelongsTo
|
|
{
|
|
return $this->belongsTo(plugin()->webman->config('database.channel_model'), 'department_id', 'department_id')->withTrashed();
|
|
}
|
|
|
|
/**
|
|
* 渠道信息
|
|
* @return BelongsTo
|
|
*/
|
|
public function announcement(): BelongsTo
|
|
{
|
|
return $this->belongsTo(plugin()->webman->config('database.announcement_model'), 'announcement_id')->withTrashed();
|
|
}
|
|
}
|