You've already forked think-plugs-notice
34 lines
765 B
PHP
34 lines
765 B
PHP
<?php
|
|
|
|
namespace jerryyan\notice\model;
|
|
|
|
use jerryyan\staff\model\StaffUser;
|
|
use think\admin\Model;
|
|
use think\db\Query;
|
|
|
|
class NoticeBroadcast extends Model
|
|
{
|
|
protected $oplogType = '通知公告管理';
|
|
protected $oplogName = '通知公告';
|
|
protected $globalScope = ['notDeleted'];
|
|
|
|
public function scopeNotDeleted(Query $query): void
|
|
{
|
|
$query->where('is_deleted', '=', 0);
|
|
}
|
|
|
|
public function scopeDeleted(Query $query): void
|
|
{
|
|
$query->where('is_deleted', '=', 1);
|
|
}
|
|
|
|
public static function types()
|
|
{
|
|
return static::mk()->group('type')->field('type')->select();
|
|
}
|
|
|
|
public function creator()
|
|
{
|
|
return $this->hasOne(StaffUser::class, 'id', 'create_by')->with(['dept']);
|
|
}
|
|
} |