@@ -20,14 +20,14 @@ |
||
20 | 20 | parent::boot(); |
21 | 21 | |
22 | 22 | // do not save already existing leaves |
23 | - static::saving(function (self $leave) { |
|
23 | + static::saving(function(self $leave) { |
|
24 | 24 | if (self::where('teacher_id', $leave->teacher_id)->where('date', $leave->date)->count() > 0) { |
25 | 25 | return false; |
26 | 26 | } |
27 | 27 | }); |
28 | 28 | |
29 | 29 | // when a leave is, we detach the events from the teacher |
30 | - static::saved(function (self $leave) { |
|
30 | + static::saved(function(self $leave) { |
|
31 | 31 | $events = Event::where('teacher_id', $leave->teacher_id)->whereDate('start', $leave->date)->get(); |
32 | 32 | foreach ($events as $event) { |
33 | 33 | $event->teacher_id = null; |
@@ -15,12 +15,12 @@ |
||
15 | 15 | parent::boot(); |
16 | 16 | |
17 | 17 | // when a coursetime is added, we should create corresponding events |
18 | - static::created(function ($coursetime) { |
|
18 | + static::created(function($coursetime) { |
|
19 | 19 | $coursetime->create_events(); |
20 | 20 | }); |
21 | 21 | |
22 | 22 | // when a coursetime is deleted, we should delete all associated future events |
23 | - static::deleted(function ($coursetime) { |
|
23 | + static::deleted(function($coursetime) { |
|
24 | 24 | $coursetime->events()->delete(); |
25 | 25 | // todo delete only future events |
26 | 26 | }); |
@@ -56,7 +56,7 @@ |
||
56 | 56 | return $this->respondToUnauthorizedRequest($request); |
57 | 57 | } |
58 | 58 | |
59 | - if (! $this->checkIfUserIsAdmin(backpack_user())) { |
|
59 | + if (!$this->checkIfUserIsAdmin(backpack_user())) { |
|
60 | 60 | return $this->respondToUnauthorizedRequest($request); |
61 | 61 | } |
62 | 62 |
@@ -19,7 +19,7 @@ |
||
19 | 19 | return redirect()->to('login'); |
20 | 20 | } |
21 | 21 | |
22 | - if (! backpack_user()->can($permission)) { |
|
22 | + if (!backpack_user()->can($permission)) { |
|
23 | 23 | abort(403); |
24 | 24 | } |
25 | 25 |
@@ -19,7 +19,7 @@ |
||
19 | 19 | return redirect('/login'); |
20 | 20 | } |
21 | 21 | |
22 | - if (! backpack_auth()->user()->hasRole($role)) { |
|
22 | + if (!backpack_auth()->user()->hasRole($role)) { |
|
23 | 23 | abort(403); |
24 | 24 | } |
25 | 25 |
@@ -14,7 +14,7 @@ |
||
14 | 14 | */ |
15 | 15 | protected function redirectTo($request) |
16 | 16 | { |
17 | - if (! $request->expectsJson()) { |
|
17 | + if (!$request->expectsJson()) { |
|
18 | 18 | return route('login'); |
19 | 19 | } |
20 | 20 | } |
@@ -17,7 +17,7 @@ |
||
17 | 17 | { |
18 | 18 | |
19 | 19 | // Check if is allowed and set default locale if not |
20 | - if (! language()->allowed($locale)) { |
|
20 | + if (!language()->allowed($locale)) { |
|
21 | 21 | $locale = config('app.locale'); |
22 | 22 | } |
23 | 23 |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | } |
115 | 115 | |
116 | 116 | // get past events for the course |
117 | - $events = $course->events->filter(function ($value, $key) { |
|
117 | + $events = $course->events->filter(function($value, $key) { |
|
118 | 118 | return Carbon::parse($value->start) < Carbon::now(); |
119 | 119 | })->sortByDesc('start'); |
120 | 120 | |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | |
200 | 200 | public function toggleEventAttendanceStatus(Event $event, Request $request) |
201 | 201 | { |
202 | - if (! backpack_user()->hasPermissionTo('courses.edit')) { |
|
202 | + if (!backpack_user()->hasPermissionTo('courses.edit')) { |
|
203 | 203 | abort(403); |
204 | 204 | } |
205 | 205 | $event->exempt_attendance = (int) $request->status; |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | |
211 | 211 | public function toggleCourseAttendanceStatus(Course $course, Request $request) |
212 | 212 | { |
213 | - if (! backpack_user()->hasPermissionTo('courses.edit')) { |
|
213 | + if (!backpack_user()->hasPermissionTo('courses.edit')) { |
|
214 | 214 | abort(403); |
215 | 215 | } |
216 | 216 | $course->exempt_attendance = (int) $request->status; |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | |
24 | 24 | $rooms = Room::all()->toArray(); |
25 | 25 | |
26 | - $rooms = array_map(function ($room) { |
|
26 | + $rooms = array_map(function($room) { |
|
27 | 27 | return [ |
28 | 28 | 'id' => $room['id'], |
29 | 29 | 'title' => $room['name'], |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | |
33 | 33 | array_push($rooms, ['id' => 'tbd', 'title' => 'Unassigned']); |
34 | 34 | |
35 | - $events = array_map(function ($event) { |
|
35 | + $events = array_map(function($event) { |
|
36 | 36 | return [ |
37 | 37 | 'title' => $event['name'], |
38 | 38 | 'resourceId' => $event['room_id'], |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | |
47 | 47 | $unassigned_events = Event::where('room_id', null)->get()->toArray(); |
48 | 48 | |
49 | - $unassigned_events = array_map(function ($event) { |
|
49 | + $unassigned_events = array_map(function($event) { |
|
50 | 50 | return [ |
51 | 51 | 'title' => $event['name'], |
52 | 52 | 'resourceId' => 'tbd', |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | public function show(Room $room) |
72 | 72 | { |
73 | 73 | $events = $room->events->toArray(); |
74 | - $events = array_map(function ($event) { |
|
74 | + $events = array_map(function($event) { |
|
75 | 75 | return [ |
76 | 76 | 'title' => $event['name'], |
77 | 77 | 'start' => $event['start'], |