'已删除', self::IS_DEL_NO => '未删除' ]; /** * The table associated with the model. * * @var string */ protected $table = 'life_book_scheduling'; public $timestamps = false; /** * Notes:获取课程排期列表 * @param string $keywords * @param int $page * @param int $limit * @return array * User: ZQ * Date: 2022/10/14 */ public static function getBookSchedulingList(int $page, int $limit, string $keywords) { $list = static::select(['life_book_scheduling.*','life_book.life_book_name','category.category_name']) ->where(['scheduling_is_del'=>static::IS_DEL_NO]) ->when($keywords != '', function ($query) use ($keywords){ $query->where('scheduling_book_id', 'like', '%' . $keywords . '%'); }) ->leftJoin('life_book','life_book_id','=','life_book_scheduling.scheduling_book_id') ->leftJoin('category','category_id','=','life_book_scheduling.scheduling_category_id') ->orderBy('scheduling_create_time','DESC') ->forPage($page, $limit) ->get(); $count = static::where(['scheduling_is_del'=>static::IS_DEL_NO]) ->when($keywords != '', function ($query) use ($keywords){ $query->where('scheduling_name', 'like', '%' . $keywords . '%'); }) ->count(); return [$list, $count]; } /** * Notes:获取所有课程 * @return array * User: ZQ * Date: 2022/10/14 */ public static function getBookAll() { $list = static::select(['scheduling_id','scheduling_name']) ->where(['scheduling_is_del'=>static::IS_DEL_NO]) ->orderBy('scheduling_create_time','DESC') ->get(); return $list; } /** * Notes:获取课程目录名称 * @param string $account * @return \Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Model|object|null * User: ZQ * Date: 2022/10/14 */ public static function schedulingMation($admin_cinema) { $where = []; $where['scheduling_is_del'] = static::IS_DEL_NO; $mation = static::where($where) ->when($admin_cinema != '', function ($query) use ($admin_cinema){ $query->whereIn('scheduling_id', $admin_cinema); }) ->get('scheduling_name'); return $mation; } }