1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- <?php
- namespace app\admin\model;
- use support\Model;
- /**
- * 农庄美食/采摘游玩模型
- * Class Users
- * @package app\admin\model
- */
- class LifePlay extends Model
- {
- const ROLE_STATUS = 1;
- const IS_DEL_YES = 1;
- const IS_DEL_NO = 0;
- const PLAY_IS_SHOW = [
- self::IS_DEL_YES => '已删除',
- self::IS_DEL_NO => '未删除'
- ];
- /**
- * The table associated with the model.
- *
- * @var string
- */
- protected $table = 'life_delicious_play';
- public $timestamps = false;
- /**
- * Notes:获取农庄美食/采摘游玩列表
- * @param string $keywords
- * @param int $page
- * @param int $limit
- * @return array
- * User: ZQ
- * Date: 2022/10/18
- */
- public static function getPlayList(int $page, int $limit, string $keywords)
- {
- $list = static::select('*')
- ->where(['play_is_del'=>static::IS_DEL_NO])
- ->when($keywords != '', function ($query) use ($keywords){
- $query->where('play_name', 'like', '%' . $keywords . '%');
- })
- ->orderBy('play_create_time','DESC')
- ->forPage($page, $limit)
- ->get();
- $count = static::where(['play_is_del'=>static::IS_DEL_NO])
- ->when($keywords != '', function ($query) use ($keywords){
- $query->where('play_name', 'like', '%' . $keywords . '%');
- })
- ->count();
- return [$list, $count];
- }
- /**
- * Notes:获取所有农庄美食/采摘游玩
- * @return array
- * User: ZQ
- * Date: 2022/10/18
- */
- public static function getPlayAll()
- {
- $list = static::select(['play_id','play_name'])
- ->where(['play_is_del'=>static::IS_DEL_NO])
- ->orderBy('play_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/18
- */
- public static function playMation($admin_cinema)
- {
- $where = [];
- $where['play_is_del'] = static::IS_DEL_NO;
- $mation = static::where($where)
- ->when($admin_cinema != '', function ($query) use ($admin_cinema){
- $query->whereIn('play_id', $admin_cinema);
- })
- ->get('play_name');
- return $mation;
- }
- }
|