| @@ 79-96 (lines=18) @@ | ||
| 76 | return Carbon::parse($this->date); |
|
| 77 | } |
|
| 78 | ||
| 79 | public function find() |
|
| 80 | { |
|
| 81 | $this->prepare(); |
|
| 82 | ||
| 83 | $results = $this->vacancies->get(); |
|
| 84 | ||
| 85 | $fromDatetime = $this->getUTCDateTime(); |
|
| 86 | ||
| 87 | if ($this->duration !== null) { |
|
| 88 | $toDatetime = $fromDatetime->addMinutes($this->duration); |
|
| 89 | ||
| 90 | $results = $results->reject(function ($vacancy) use ($fromDatetime, $toDatetime) { |
|
| 91 | return !$vacancy->hasRoomBetween($fromDatetime, $toDatetime); |
|
| 92 | }); |
|
| 93 | } |
|
| 94 | ||
| 95 | return $results; |
|
| 96 | } |
|
| 97 | ||
| 98 | protected function prepare() |
|
| 99 | { |
|
| @@ 7-24 (lines=18) @@ | ||
| 4 | ||
| 5 | class TimeslotCalendar extends BaseCalendar |
|
| 6 | { |
|
| 7 | public function find() |
|
| 8 | { |
|
| 9 | $this->prepare(); |
|
| 10 | ||
| 11 | $results = $this->vacancies->get(); |
|
| 12 | ||
| 13 | $fromDatetime = $this->getUTCDateTime(); |
|
| 14 | ||
| 15 | if ($this->duration !== null) { |
|
| 16 | $toDatetime = $fromDatetime->addMinutes($this->duration); |
|
| 17 | ||
| 18 | $results = $results->reject(function ($vacancy) use ($fromDatetime, $toDatetime) { |
|
| 19 | return !$vacancy->hasRoomBetween($fromDatetime, $toDatetime); |
|
| 20 | }); |
|
| 21 | } |
|
| 22 | ||
| 23 | return $results; |
|
| 24 | } |
|
| 25 | ||
| 26 | protected function prepare() |
|
| 27 | { |
|