'正常', self::STATUS_DEL_YES => '删除' ]; /** * The table associated with the model. * * @var string */ protected $table = 'medical_care_notice'; public $timestamps = false; /** * Notes:获取菜单列表 * @param string $keywords * @param int $page * @param int $limit * @return array * User: ZQ * Date: 2022/9/14 */ public static function getNoticeList(int $page, int $limit, string $keywords) { $list = static::select('*')->where(['notice_del'=>static::STATUS_DEL_NO]) ->when($keywords != '', function ($query) use ($keywords){ $query->where('notice_name', 'like', '%' . $keywords . '%'); }) ->forPage($page,$limit) ->orderBy('notice_sort','DESC') ->orderBy('notice_create_time','DESC') ->get(); $count = static::where(['notice_del'=>static::STATUS_DEL_NO]) ->when($keywords != '', function ($query) use ($keywords){ $query->where('notice_name', 'like', '%' . $keywords . '%'); }) ->count(); return [$list,$count]; } /** * Notes:查询指定条件下的某个字段内容 * @param int $notice_id * @param string $field * User: ZQ * Date: 2022/9/27 */ public static function getValue(int $notice_id, string $field) { return static::where(['notice_id' => $notice_id])->value($field); } }