@@ -59,14 +59,17 @@ |
||
59 | 59 | */ |
60 | 60 | public function parseStatusKey($status) |
61 | 61 | { |
62 | - if(is_int($status)) |
|
63 | - $status = ScheduleStatus::find($status); |
|
62 | + if(is_int($status)) { |
|
63 | + $status = ScheduleStatus::find($status); |
|
64 | + } |
|
64 | 65 | |
65 | - if(is_string($status)) |
|
66 | - $status = ScheduleStatus::where('name', $status)->first(); |
|
66 | + if(is_string($status)) { |
|
67 | + $status = ScheduleStatus::where('name', $status)->first(); |
|
68 | + } |
|
67 | 69 | |
68 | - if(is_null($status)) |
|
69 | - throw (new ModelNotFound)->setValues(ScheduleStatus::class); |
|
70 | + if(is_null($status)) { |
|
71 | + throw (new ModelNotFound)->setValues(ScheduleStatus::class); |
|
72 | + } |
|
70 | 73 | |
71 | 74 | return ['status' => $status->id]; |
72 | 75 | } |
@@ -43,8 +43,9 @@ discard block |
||
43 | 43 | */ |
44 | 44 | public function hasScheduleBetween($model_type, $start_at, $end_at) |
45 | 45 | { |
46 | - if(!Config::get('scheduler.enable_schedule_conflict')) |
|
47 | - return false; |
|
46 | + if(!Config::get('scheduler.enable_schedule_conflict')) { |
|
47 | + return false; |
|
48 | + } |
|
48 | 49 | |
49 | 50 | return !is_null( |
50 | 51 | Schedule::latest() |
@@ -99,23 +100,27 @@ discard block |
||
99 | 100 | $start = Carbon::parse($schedule->start_at); |
100 | 101 | $begin = Carbon::parse($start->toDateString()); |
101 | 102 | |
102 | - if($begin->greaterThan($today)) |
|
103 | - break; |
|
103 | + if($begin->greaterThan($today)) { |
|
104 | + break; |
|
105 | + } |
|
104 | 106 | |
105 | - if($begin->notEqualTo($today)) |
|
106 | - continue; |
|
107 | + if($begin->notEqualTo($today)) { |
|
108 | + continue; |
|
109 | + } |
|
107 | 110 | |
108 | 111 | $end = Carbon::parse($schedule->end_at); |
109 | 112 | |
110 | - if($this->isShouldntAdd($opening, $closing, $start, $end)) |
|
111 | - $add = false; |
|
113 | + if($this->isShouldntAdd($opening, $closing, $start, $end)) { |
|
114 | + $add = false; |
|
115 | + } |
|
112 | 116 | } |
113 | 117 | |
114 | - if($add && $closing->lessThanOrEqualTo($closingTime)) |
|
115 | - $livres[] = [ |
|
118 | + if($add && $closing->lessThanOrEqualTo($closingTime)) { |
|
119 | + $livres[] = [ |
|
116 | 120 | 'start_at' => $opening, |
117 | 121 | 'end_at' => $closing |
118 | 122 | ]; |
123 | + } |
|
119 | 124 | |
120 | 125 | $openingTime->addMinutes($durationMinutes); |
121 | 126 | } |