| 1234567891011121314151617181920212223242526272829303132333435 |
- <?php
- namespace app\common\model\movie\cinema;
- use app\model\BaseModel;
- class Cinema extends BaseModel
- {
- protected $name = 'movie_cinema';
- public static function tablePk(): ?string
- {
- return 'id';
- }
- /**
- * @param $model
- * @param array $where
- * @return Cinema
- */
- public function search($model = null, array $where = [])
- {
- $model = $model ?? new self();
- return $model->when(isset($where['cinema_name']) && $where['cinema_name'], function ($query) use ($where) {
- $query->where('cinema_name', 'like', "%{$where['cinema_name']}%");
- })->when(isset($where['cate_one_id']) && $where['cate_one_id'], function ($query) use ($where) {
- $query->where('cate_one_id', $where['cate_one_id']);
- })->when(isset($where['cate_two_id']) && $where['cate_two_id'], function ($query) use ($where) {
- $query->where('cate_two_id', $where['cate_two_id']);
- })->when(isset($where['city']) && $where['city'], function ($query) use ($where) {
- $query->where('city', 'like', "%{$where['city']}%");
- });
- }
- }
|