@@ -32,7 +32,7 @@ |
||
32 | 32 | // foreach partner with an alert set for this day of month |
33 | 33 | foreach (Partner::where('send_report_on', Carbon::now()->day)->get() as $partner) { |
34 | 34 | // get all courses |
35 | - $courses = $partner->courses()->whereHas('events', function (Builder $query) use ($period_start, $period_end) { |
|
35 | + $courses = $partner->courses()->whereHas('events', function(Builder $query) use ($period_start, $period_end) { |
|
36 | 36 | $query->where('start', '>=', $period_start->toDateString())->where('end', '<=', $period_end->toDateString()); |
37 | 37 | }) |
38 | 38 | ->with('events')->withCount('events') |
@@ -34,12 +34,12 @@ discard block |
||
34 | 34 | */ |
35 | 35 | protected function schedule(Schedule $schedule) |
36 | 36 | { |
37 | - $schedule->call(function () { |
|
37 | + $schedule->call(function() { |
|
38 | 38 | Log::info('Sending attendance reminders'); |
39 | 39 | $this->remindPendingAttendance(); |
40 | 40 | })->dailyAt('08:15'); |
41 | 41 | |
42 | - $schedule->call(function () { |
|
42 | + $schedule->call(function() { |
|
43 | 43 | Log::info('Checking default periods'); |
44 | 44 | |
45 | 45 | // when we finish the current period; remove the manual override to automatically fallbackto the next one |
@@ -57,14 +57,14 @@ discard block |
||
57 | 57 | })->dailyAt('00:00'); |
58 | 58 | |
59 | 59 | if (config('settings.partnership_alerts')) { |
60 | - $schedule->call(function () { |
|
60 | + $schedule->call(function() { |
|
61 | 61 | Log::info('Checking expired partnerships'); |
62 | 62 | |
63 | 63 | // if one of the partnerships is expiring soon, send an email |
64 | - $partners = Partner::where(function ($query) { |
|
64 | + $partners = Partner::where(function($query) { |
|
65 | 65 | $query->whereNotNull('expired_on')->where('expired_on', '<', Carbon::now()->addDays(28)); |
66 | 66 | }) |
67 | - ->where(function ($query) { |
|
67 | + ->where(function($query) { |
|
68 | 68 | $query->whereNull('last_alert_sent_at')->orWhere('last_alert_sent_at', '>', Carbon::now()->subDays(28))->get(); |
69 | 69 | }); |
70 | 70 | |
@@ -75,14 +75,14 @@ discard block |
||
75 | 75 | } |
76 | 76 | |
77 | 77 | if (config('settings.external_courses_report')) { |
78 | - $schedule->call(function () { |
|
78 | + $schedule->call(function() { |
|
79 | 79 | Log::info('Sending external courses reports'); |
80 | 80 | event(new ExternalCoursesReportEvent()); |
81 | 81 | })->dailyAt('02:10'); |
82 | 82 | } |
83 | 83 | |
84 | 84 | if (config('settings.monthly_report')) { |
85 | - $schedule->call(function () { |
|
85 | + $schedule->call(function() { |
|
86 | 86 | Log::info('Sending monthly hours report'); |
87 | 87 | event(new MonthlyReportEvent()); |
88 | 88 | })->monthlyOn(20); |
@@ -32,7 +32,7 @@ |
||
32 | 32 | $this->crud->allowAccess(['showstudentphotoroster']); |
33 | 33 | $this->crud->setOperationSetting('setFromDb', true); |
34 | 34 | |
35 | - $this->crud->operation('showstudentphotoroster', function () { |
|
35 | + $this->crud->operation('showstudentphotoroster', function() { |
|
36 | 36 | $this->crud->loadDefaultOperationSettingsFromConfig(); |
37 | 37 | }); |
38 | 38 |
@@ -52,11 +52,11 @@ |
||
52 | 52 | } |
53 | 53 | |
54 | 54 | View::composer( |
55 | - ['partials.create_new_contact', 'students.edit-contact'], function ($view) { |
|
55 | + ['partials.create_new_contact', 'students.edit-contact'], function($view) { |
|
56 | 56 | $view->with('contact_types', ContactRelationship::all()); |
57 | 57 | }); |
58 | 58 | |
59 | - View::composer('partials.add_book_to_student', function ($view) { |
|
59 | + View::composer('partials.add_book_to_student', function($view) { |
|
60 | 60 | $view->with('books', Book::all()); |
61 | 61 | $view->with('statuses', EnrollmentStatusType::all()); |
62 | 62 | }); |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | |
21 | 21 | $this->hideSensitiveRequestDetails(); |
22 | 22 | |
23 | - Telescope::filter(function (IncomingEntry $entry) { |
|
23 | + Telescope::filter(function(IncomingEntry $entry) { |
|
24 | 24 | if ($this->app->isLocal()) { |
25 | 25 | return true; |
26 | 26 | } |
@@ -61,6 +61,6 @@ discard block |
||
61 | 61 | */ |
62 | 62 | protected function gate() |
63 | 63 | { |
64 | - Gate::define('viewTelescope', fn ($user = null) => backpack_user() && backpack_user()->email === config('app.admin_email')); |
|
64 | + Gate::define('viewTelescope', fn($user = null) => backpack_user() && backpack_user()->email === config('app.admin_email')); |
|
65 | 65 | } |
66 | 66 | } |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | |
133 | 133 | public function updateCourse(Course $course) : void |
134 | 134 | { |
135 | - if (! $course->lms_id) { |
|
135 | + if (!$course->lms_id) { |
|
136 | 136 | $this->createCourse($course); |
137 | 137 | } |
138 | 138 | |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | Log::info('found these teachers IDs on LMS:'.implode(', ', $teachers->pluck('id')->toArray())); |
162 | 162 | |
163 | 163 | // if the course has no teacher, stop |
164 | - if (! $course->teacher) { |
|
164 | + if (!$course->teacher) { |
|
165 | 165 | Log::alert('The course has no teacher on local system, removing all teachers from remote'); |
166 | 166 | foreach ($teachers as $teacher) { |
167 | 167 | $this->removeTeacher($course->lms_id, $teacher['id']); |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | } |
177 | 177 | } |
178 | 178 | |
179 | - if (! $course->teacher->user->lms_id || ! $teachers->contains('id', $course->teacher->user->lms_id)) { |
|
179 | + if (!$course->teacher->user->lms_id || !$teachers->contains('id', $course->teacher->user->lms_id)) { |
|
180 | 180 | Log::info('the course teacher has changed, need to update it'); |
181 | 181 | $this->addTeacher($course); |
182 | 182 | } |
@@ -186,14 +186,14 @@ discard block |
||
186 | 186 | |
187 | 187 | public function enrollStudent(Course $course, Student $student): void |
188 | 188 | { |
189 | - if (! $course->lms_id) { |
|
189 | + if (!$course->lms_id) { |
|
190 | 190 | abort(404, 'This course is not synced with external LMS'); |
191 | 191 | } |
192 | 192 | |
193 | 193 | $courseId = $course->lms_id; |
194 | 194 | |
195 | 195 | // if the student is not synced with the LMS, create them |
196 | - if (! $student->user->lms_id) { |
|
196 | + if (!$student->user->lms_id) { |
|
197 | 197 | $this->createUser($student->user); |
198 | 198 | } |
199 | 199 | |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | // only process if the course has a teacher |
217 | 217 | if ($course->teacher_id) { |
218 | 218 | // if the teacher doesn't exist on LMS, create them |
219 | - if (! $course->teacher->user->lms_id) { |
|
219 | + if (!$course->teacher->user->lms_id) { |
|
220 | 220 | Log::info('creating user now'); |
221 | 221 | $this->createUser($course->teacher->user); |
222 | 222 | } |
@@ -24,14 +24,14 @@ discard block |
||
24 | 24 | |
25 | 25 | $rooms = Room::all()->toArray(); |
26 | 26 | |
27 | - $rooms = array_map(fn ($room) => [ |
|
27 | + $rooms = array_map(fn($room) => [ |
|
28 | 28 | 'id' => $room['id'], |
29 | 29 | 'title' => $room['name'], |
30 | 30 | ], $rooms); |
31 | 31 | |
32 | 32 | array_push($rooms, ['id' => 'tbd', 'title' => 'Unassigned']); |
33 | 33 | |
34 | - $events = array_map(fn ($event) => [ |
|
34 | + $events = array_map(fn($event) => [ |
|
35 | 35 | 'title' => $event['name'], |
36 | 36 | 'resourceId' => $event['room_id'], |
37 | 37 | 'start' => $event['start'], |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | |
44 | 44 | $unassigned_events = Event::where('room_id', null)->get()->toArray(); |
45 | 45 | |
46 | - $unassigned_events = array_map(fn ($event) => [ |
|
46 | + $unassigned_events = array_map(fn($event) => [ |
|
47 | 47 | 'title' => $event['name'], |
48 | 48 | 'resourceId' => 'tbd', |
49 | 49 | 'start' => $event['start'], |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | public function show(Room $room) |
67 | 67 | { |
68 | 68 | $events = $room->events->toArray(); |
69 | - $events = array_map(fn ($event) => [ |
|
69 | + $events = array_map(fn($event) => [ |
|
70 | 70 | 'title' => $event['name'], |
71 | 71 | 'start' => $event['start'], |
72 | 72 | 'end' => $event['end'], |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | } |
113 | 113 | |
114 | 114 | // get past events for the course |
115 | - $events = $course->events->filter(fn ($value, $key) => Carbon::parse($value->start) < Carbon::now())->sortByDesc('start'); |
|
115 | + $events = $course->events->filter(fn($value, $key) => Carbon::parse($value->start) < Carbon::now())->sortByDesc('start'); |
|
116 | 116 | |
117 | 117 | // if the course has any past events |
118 | 118 | if (($events->count() == 0) || ($course->enrollments()->count() == 0)) { |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | |
197 | 197 | public function toggleEventAttendanceStatus(Event $event, Request $request) |
198 | 198 | { |
199 | - if (! backpack_user()->hasPermissionTo('courses.edit')) { |
|
199 | + if (!backpack_user()->hasPermissionTo('courses.edit')) { |
|
200 | 200 | abort(403); |
201 | 201 | } |
202 | 202 | $event->exempt_attendance = (int) $request->status; |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | |
208 | 208 | public function toggleCourseAttendanceStatus(Course $course, Request $request) |
209 | 209 | { |
210 | - if (! backpack_user()->hasPermissionTo('courses.edit')) { |
|
210 | + if (!backpack_user()->hasPermissionTo('courses.edit')) { |
|
211 | 211 | abort(403); |
212 | 212 | } |
213 | 213 | $course->exempt_attendance = (int) $request->status; |
@@ -90,10 +90,10 @@ discard block |
||
90 | 90 | 'name' => 'action', |
91 | 91 | 'label'=> 'Action', |
92 | 92 | ], |
93 | - false, |
|
94 | - function () { // if the filter is active |
|
95 | - CRUD::addClause('where', 'action', true); |
|
96 | - }); |
|
93 | + false, |
|
94 | + function () { // if the filter is active |
|
95 | + CRUD::addClause('where', 'action', true); |
|
96 | + }); |
|
97 | 97 | |
98 | 98 | CRUD::addFilter([ // dropdown filter |
99 | 99 | 'name' => 'type', |
@@ -109,10 +109,10 @@ discard block |
||
109 | 109 | ], function ($value) { // if the filter is active |
110 | 110 | CRUD::addClause('where', 'commentable_type', '=', $value); |
111 | 111 | }, |
112 | - function () { // if the filter is not active |
|
113 | - CRUD::addClause('where', 'commentable_type', '=', Student::class); |
|
114 | - $this->crud->getRequest()->request->add(['commentable_type' => Student::class]); // to make the filter look active |
|
115 | - }); |
|
112 | + function () { // if the filter is not active |
|
113 | + CRUD::addClause('where', 'commentable_type', '=', Student::class); |
|
114 | + $this->crud->getRequest()->request->add(['commentable_type' => Student::class]); // to make the filter look active |
|
115 | + }); |
|
116 | 116 | } |
117 | 117 | |
118 | 118 | public function setupUpdateOperation() |
@@ -85,17 +85,17 @@ discard block |
||
85 | 85 | ], |
86 | 86 | ]); |
87 | 87 | |
88 | - CRUD::addFilter([ // simple filter |
|
88 | + CRUD::addFilter([// simple filter |
|
89 | 89 | 'type' => 'simple', |
90 | 90 | 'name' => 'action', |
91 | 91 | 'label'=> 'Action', |
92 | 92 | ], |
93 | 93 | false, |
94 | - function () { // if the filter is active |
|
94 | + function() { // if the filter is active |
|
95 | 95 | CRUD::addClause('where', 'action', true); |
96 | 96 | }); |
97 | 97 | |
98 | - CRUD::addFilter([ // dropdown filter |
|
98 | + CRUD::addFilter([// dropdown filter |
|
99 | 99 | 'name' => 'type', |
100 | 100 | 'type' => 'dropdown', |
101 | 101 | 'label'=> 'Type', |
@@ -106,10 +106,10 @@ discard block |
||
106 | 106 | Invoice::class => 'Invoice', |
107 | 107 | Result::class => 'Result', |
108 | 108 | |
109 | - ], function ($value) { // if the filter is active |
|
109 | + ], function($value) { // if the filter is active |
|
110 | 110 | CRUD::addClause('where', 'commentable_type', '=', $value); |
111 | 111 | }, |
112 | - function () { // if the filter is not active |
|
112 | + function() { // if the filter is not active |
|
113 | 113 | CRUD::addClause('where', 'commentable_type', '=', Student::class); |
114 | 114 | $this->crud->getRequest()->request->add(['commentable_type' => Student::class]); // to make the filter look active |
115 | 115 | }); |