@@ -23,7 +23,7 @@ |
||
23 | 23 | parent::boot(); |
24 | 24 | |
25 | 25 | // when an attendance record is added, we check if this is an absence |
26 | - static::saved(function (self $attendance) { |
|
26 | + static::saved(function(self $attendance) { |
|
27 | 27 | if ($attendance->attendance_type_id == 4) { // todo move to configurable settings |
28 | 28 | // Log::info('Absence marked for student '.$attendance->student->name); |
29 | 29 | // will check the record again and send a notification if it hasn't changed |
@@ -309,7 +309,7 @@ discard block |
||
309 | 309 | */ |
310 | 310 | public function skills() |
311 | 311 | { |
312 | - return $this->evaluationType?->skills()->orderBy('order'); |
|
312 | + return $this->evaluationType ? ->skills()->orderBy('order'); |
|
313 | 313 | } |
314 | 314 | |
315 | 315 | public function books() |
@@ -334,7 +334,7 @@ discard block |
||
334 | 334 | */ |
335 | 335 | public function getPendingAttendanceAttribute() |
336 | 336 | { |
337 | - $events = Event::where(function ($query) { |
|
337 | + $events = Event::where(function($query) { |
|
338 | 338 | $query->where('course_id', $this->id); |
339 | 339 | $query->where('exempt_attendance', '!=', true); |
340 | 340 | $query->where('exempt_attendance', '!=', 1); |
@@ -471,7 +471,7 @@ discard block |
||
471 | 471 | foreach ($courseTimes as $courseTime) { |
472 | 472 | $initial = $daysInitials[$courseTime->day]; |
473 | 473 | |
474 | - if (! isset($parsedCourseTimes[$initial])) { |
|
474 | + if (!isset($parsedCourseTimes[$initial])) { |
|
475 | 475 | $parsedCourseTimes[$initial] = []; |
476 | 476 | } |
477 | 477 | |
@@ -518,7 +518,7 @@ discard block |
||
518 | 518 | public function getCourseTeacherNameAttribute() |
519 | 519 | { |
520 | 520 | if ($this->teacher_id) { |
521 | - return $this->teacher?->name; |
|
521 | + return $this->teacher ? ->name; |
|
522 | 522 | } else { |
523 | 523 | return '-'; |
524 | 524 | } |
@@ -531,7 +531,7 @@ discard block |
||
531 | 531 | |
532 | 532 | public function getDescriptionAttribute() |
533 | 533 | { |
534 | - return '[' . $this->course_period_name . '] - ' . $this->name; |
|
534 | + return '['.$this->course_period_name.'] - '.$this->name; |
|
535 | 535 | } |
536 | 536 | |
537 | 537 | public function getChildrenCountAttribute() |
@@ -552,7 +552,7 @@ discard block |
||
552 | 552 | |
553 | 553 | public function getAcceptsNewStudentsAttribute(): bool |
554 | 554 | { |
555 | - if (! $this->spots || $this->spots == 0) { |
|
555 | + if (!$this->spots || $this->spots == 0) { |
|
556 | 556 | return true; |
557 | 557 | } |
558 | 558 | |
@@ -575,7 +575,7 @@ discard block |
||
575 | 575 | |
576 | 576 | public function eventsWithExpectedAttendance() |
577 | 577 | { |
578 | - return $this->events()->where(function ($query) { |
|
578 | + return $this->events()->where(function($query) { |
|
579 | 579 | $query->where('exempt_attendance', '!=', true); |
580 | 580 | $query->where('exempt_attendance', '!=', 1); |
581 | 581 | $query->orWhereNull('exempt_attendance'); |
@@ -604,10 +604,10 @@ discard block |
||
604 | 604 | { |
605 | 605 | if (config('app.currency_position') === 'before') |
606 | 606 | { |
607 | - return config('app.currency_symbol') . " ". $this->price; |
|
607 | + return config('app.currency_symbol')." ".$this->price; |
|
608 | 608 | } |
609 | 609 | |
610 | - return $this->price . " " . config('app.currency_symbol'); |
|
610 | + return $this->price." ".config('app.currency_symbol'); |
|
611 | 611 | } |
612 | 612 | |
613 | 613 |
@@ -74,6 +74,6 @@ |
||
74 | 74 | |
75 | 75 | public function getCompleteNameAttribute() : string |
76 | 76 | { |
77 | - return '[' . ($this->level->name ?? '') . '] ' . ($this->skill_type->shortname ?? '') . ' - ' . $this->name ?? ''; |
|
77 | + return '['.($this->level->name ?? '').'] '.($this->skill_type->shortname ?? '').' - '.$this->name ?? ''; |
|
78 | 78 | } |
79 | 79 | } |
@@ -27,7 +27,7 @@ |
||
27 | 27 | { |
28 | 28 | // if the student is enrolled in any class by the user |
29 | 29 | |
30 | - return $student->enrollments()->whereHas('course', function ($q) use ($user) { |
|
30 | + return $student->enrollments()->whereHas('course', function($q) use ($user) { |
|
31 | 31 | return $q->where('teacher_id', $user->id); |
32 | 32 | })->count() > 0; |
33 | 33 | } |
@@ -73,10 +73,10 @@ |
||
73 | 73 | { |
74 | 74 | if (config('app.currency_position') === 'before') |
75 | 75 | { |
76 | - return config('app.currency_symbol') . " ". $this->price; |
|
76 | + return config('app.currency_symbol')." ".$this->price; |
|
77 | 77 | } |
78 | 78 | |
79 | - return $this->price . " " . config('app.currency_symbol'); |
|
79 | + return $this->price." ".config('app.currency_symbol'); |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | public function getTypeAttribute() |
@@ -52,7 +52,7 @@ |
||
52 | 52 | public function getCompleteNameAttribute() |
53 | 53 | { |
54 | 54 | if ($this->category) { |
55 | - return '[' . $this->category->name . '] ' . $this->name; |
|
55 | + return '['.$this->category->name.'] '.$this->name; |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | return null; |
@@ -121,11 +121,11 @@ discard block |
||
121 | 121 | public function scopeWithoutChildren($query) |
122 | 122 | { |
123 | 123 | return $query |
124 | - ->where(function ($query) { |
|
124 | + ->where(function($query) { |
|
125 | 125 | $query->whereDoesntHave('childrenEnrollments') |
126 | 126 | ->where('parent_id', null); |
127 | 127 | }) |
128 | - ->orWhere(function ($query) { |
|
128 | + ->orWhere(function($query) { |
|
129 | 129 | $query->where('parent_id', null); |
130 | 130 | }) |
131 | 131 | ->get(); |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | |
148 | 148 | public function scopePeriod(Builder $query, $period) |
149 | 149 | { |
150 | - return $query->whereHas('course', function ($q) use ($period) { |
|
150 | + return $query->whereHas('course', function($q) use ($period) { |
|
151 | 151 | $q->where('period_id', $period); |
152 | 152 | }); |
153 | 153 | } |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | |
295 | 295 | public function getNameAttribute() |
296 | 296 | { |
297 | - return __("Enrollment for") . ' ' . $this->student_name; |
|
297 | + return __("Enrollment for").' '.$this->student_name; |
|
298 | 298 | } |
299 | 299 | |
300 | 300 | public function getTypeAttribute() |
@@ -380,10 +380,10 @@ discard block |
||
380 | 380 | { |
381 | 381 | if (config('app.currency_position') === 'before') |
382 | 382 | { |
383 | - return config('app.currency_symbol') . " ". $this->price; |
|
383 | + return config('app.currency_symbol')." ".$this->price; |
|
384 | 384 | } |
385 | 385 | |
386 | - return $this->price . " " . config('app.currency_symbol'); |
|
386 | + return $this->price." ".config('app.currency_symbol'); |
|
387 | 387 | } |
388 | 388 | |
389 | 389 | public function cancel() |
@@ -397,13 +397,13 @@ discard block |
||
397 | 397 | |
398 | 398 | // delete attendance records related to the enrollment |
399 | 399 | $attendances = $this->course->attendance->where('student_id', $this->student->id); |
400 | - Attendance::destroy($attendances->map(function ($item, $key) { |
|
400 | + Attendance::destroy($attendances->map(function($item, $key) { |
|
401 | 401 | return $item->id; |
402 | 402 | })); |
403 | 403 | |
404 | 404 | foreach ($this->course->children as $child) { |
405 | 405 | $attendances = $child->attendance->where('student_id', $this->student->id); |
406 | - Attendance::destroy($attendances->map(function ($item, $key) { |
|
406 | + Attendance::destroy($attendances->map(function($item, $key) { |
|
407 | 407 | return $item->id; |
408 | 408 | })); |
409 | 409 | } |
@@ -144,9 +144,9 @@ discard block |
||
144 | 144 | |
145 | 145 | public function scopeComputedLeadType($query, $leadTypeId) |
146 | 146 | { |
147 | - return match ($leadTypeId) { |
|
148 | - 1 => $query->whereHas('enrollments', function ($query) { |
|
149 | - return $query->whereHas('course', function ($q) { |
|
147 | + return match($leadTypeId) { |
|
148 | + 1 => $query->whereHas('enrollments', function($query) { |
|
149 | + return $query->whereHas('course', function($q) { |
|
150 | 150 | $q->where('period_id', Period::get_default_period()->id); |
151 | 151 | }); |
152 | 152 | }), |
@@ -155,18 +155,18 @@ discard block |
||
155 | 155 | |
156 | 156 | 4 => $query |
157 | 157 | ->where('lead_type_id', $leadTypeId) |
158 | - ->orWhere(function ($query) { |
|
158 | + ->orWhere(function($query) { |
|
159 | 159 | $query |
160 | 160 | ->whereNull('lead_type_id') |
161 | - ->whereHas('enrollments', function ($query) { |
|
161 | + ->whereHas('enrollments', function($query) { |
|
162 | 162 | return $query |
163 | - ->whereHas('course', function ($q) { |
|
163 | + ->whereHas('course', function($q) { |
|
164 | 164 | $q->where('period_id', '!=', Period::get_default_period()->id); |
165 | 165 | }); |
166 | 166 | }) |
167 | - ->whereDoesntHave('enrollments', function ($query) { |
|
167 | + ->whereDoesntHave('enrollments', function($query) { |
|
168 | 168 | return $query |
169 | - ->whereHas('course', function ($q) { |
|
169 | + ->whereHas('course', function($q) { |
|
170 | 170 | $q->where('period_id', Period::get_default_period()->id); |
171 | 171 | }); |
172 | 172 | }); |
@@ -202,8 +202,8 @@ discard block |
||
202 | 202 | |
203 | 203 | return $this->hasMany(Attendance::class) |
204 | 204 | ->where('attendance_type_id', 4) // absence |
205 | - ->whereHas('event', function ($q) use ($period) { |
|
206 | - return $q->whereHas('course', function ($c) use ($period) { |
|
205 | + ->whereHas('event', function($q) use ($period) { |
|
206 | + return $q->whereHas('course', function($c) use ($period) { |
|
207 | 207 | return $c->where('period_id', $period->id); |
208 | 208 | }); |
209 | 209 | }); |
@@ -216,8 +216,8 @@ discard block |
||
216 | 216 | } |
217 | 217 | |
218 | 218 | return $this->hasMany(Attendance::class) |
219 | - ->whereHas('event', function ($q) use ($period) { |
|
220 | - return $q->whereHas('course', function ($c) use ($period) { |
|
219 | + ->whereHas('event', function($q) use ($period) { |
|
220 | + return $q->whereHas('course', function($c) use ($period) { |
|
221 | 221 | return $c->where('period_id', $period->id); |
222 | 222 | }); |
223 | 223 | }); |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | public function getNameAttribute(): string |
301 | 301 | { |
302 | 302 | if ($this->user) { |
303 | - return ($this->title ? ($this->title->title . ' ') : '') . $this->firstname.' '.$this->lastname; |
|
303 | + return ($this->title ? ($this->title->title.' ') : '').$this->firstname.' '.$this->lastname; |
|
304 | 304 | } |
305 | 305 | return ''; |
306 | 306 | } |
@@ -318,7 +318,7 @@ discard block |
||
318 | 318 | public function getIsEnrolledAttribute() |
319 | 319 | { |
320 | 320 | // if the student is currently enrolled |
321 | - if ($this->enrollments()->whereHas('course', function ($q) { |
|
321 | + if ($this->enrollments()->whereHas('course', function($q) { |
|
322 | 322 | return $q->where('period_id', Period::get_default_period()->id); |
323 | 323 | })->count() > 0) { |
324 | 324 | return 1; |
@@ -70,22 +70,22 @@ discard block |
||
70 | 70 | /** attributes */ |
71 | 71 | public function getFirstnameAttribute() : ?string |
72 | 72 | { |
73 | - return $this?->user?->firstname; |
|
73 | + return $this ? ->user ? ->firstname; |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | public function getLastnameAttribute() : ?string |
77 | 77 | { |
78 | - return $this?->user?->lastname; |
|
78 | + return $this ? ->user ? ->lastname; |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | public function getEmailAttribute() : ?string |
82 | 82 | { |
83 | - return $this?->user?->email ?? ""; |
|
83 | + return $this ? ->user ? ->email ?? ""; |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | public function getNameAttribute() : ?string |
87 | 87 | { |
88 | - return $this?->user?->firstname.' '.$this?->user?->lastname; |
|
88 | + return $this ? ->user ? ->firstname.' '.$this ? ->user ? ->lastname; |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | public function period_courses(Period $period) |
@@ -212,15 +212,15 @@ discard block |
||
212 | 212 | $eventsWithMissingAttendance = []; |
213 | 213 | |
214 | 214 | $eventsWithExpectedAttendance = $this->events() |
215 | - ->where(function ($query) { |
|
215 | + ->where(function($query) { |
|
216 | 216 | $query->where('exempt_attendance', '!=', true); |
217 | 217 | $query->where('exempt_attendance', '!=', 1); |
218 | 218 | $query->orWhereNull('exempt_attendance'); |
219 | 219 | }) |
220 | 220 | ->where('course_id', '!=', null) |
221 | - ->whereHas('course', function (Builder $query) use ($period) { |
|
221 | + ->whereHas('course', function(Builder $query) use ($period) { |
|
222 | 222 | return $query->where('period_id', $period->id) |
223 | - ->where(function ($query) { |
|
223 | + ->where(function($query) { |
|
224 | 224 | $query->where('exempt_attendance', '!=', true); |
225 | 225 | $query->where('exempt_attendance', '!=', 1); |
226 | 226 | $query->orWhereNull('exempt_attendance'); |