CinemaSched.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. namespace app\common\model\movie\cinema;
  3. use app\model\BaseModel;
  4. class CinemaSched extends BaseModel
  5. {
  6. protected $name = 'movie_cinema_sched';
  7. public static function tablePk(): ?string
  8. {
  9. return 'id';
  10. }
  11. /**
  12. * @param $model
  13. * @param array $where
  14. * @return CinemaSched
  15. */
  16. public function search($model = null, array $where = [])
  17. {
  18. $model = $model ?? new self();
  19. return $model->when(isset($where['film_sign']) && $where['film_sign'], function ($query) use ($where) {
  20. $query->where('film_sign', $where['film_sign']);
  21. })->when(isset($where['cinema_sign']) && $where['cinema_sign'], function ($query) use ($where) {
  22. $query->where('cinema_sign', $where['cinema_sign']);
  23. })->when(isset($where['show_date']) && $where['show_date'], function ($query) use ($where) {
  24. $query->where('show_date', $where['show_date']);
  25. })->when(isset($where['relation_id']) && $where['relation_id'], function ($query) use ($where) {
  26. $query->where('relation_id', $where['relation_id']);
  27. })->when(isset($where['sched_sign']) && $where['sched_sign'], function ($query) use ($where) {
  28. $query->where('sched_sign', $where['sched_sign']);
  29. });
  30. }
  31. }