@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | |
30 | 30 | public function scopeStatus(Builder $query, $status) |
31 | 31 | { |
32 | - return match ($status) { |
|
32 | + return match($status) { |
|
33 | 33 | '2' => $query->where('status', 2)->orWhereHas('invoices'), |
34 | 34 | '1' => $query->where('status', 1)->orWhereDoesntHave('invoices'), |
35 | 35 | default => $query, |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | |
111 | 111 | public function getStatusTypeNameAttribute() |
112 | 112 | { |
113 | - return match ($this->computed_status) { |
|
113 | + return match($this->computed_status) { |
|
114 | 114 | 2 => __('Paid'), |
115 | 115 | 1 => __('Pending'), |
116 | 116 | default => '-', |
@@ -46,8 +46,8 @@ discard block |
||
46 | 46 | |
47 | 47 | public function scopeEnrolled($query) |
48 | 48 | { |
49 | - return $query->whereHas('enrollments', function ($q) { |
|
50 | - return $q->whereHas('course', function ($q) { |
|
49 | + return $query->whereHas('enrollments', function($q) { |
|
50 | + return $q->whereHas('course', function($q) { |
|
51 | 51 | return $q->where('period_id', Period::get_default_period()->id); |
52 | 52 | }); |
53 | 53 | }); |
@@ -55,8 +55,8 @@ discard block |
||
55 | 55 | |
56 | 56 | public function scopeComputedLeadType($query, $leadTypeId) |
57 | 57 | { |
58 | - return match ($leadTypeId) { |
|
59 | - 1 => $query->whereHas('enrollments', fn ($query) => $query->whereHas('course', function ($q) { |
|
58 | + return match($leadTypeId) { |
|
59 | + 1 => $query->whereHas('enrollments', fn($query) => $query->whereHas('course', function($q) { |
|
60 | 60 | $q->where('period_id', Period::get_default_period()->id); |
61 | 61 | })), |
62 | 62 | |
@@ -64,15 +64,15 @@ discard block |
||
64 | 64 | |
65 | 65 | 4 => $query |
66 | 66 | ->where('lead_type_id', $leadTypeId) |
67 | - ->orWhere(function ($query) { |
|
67 | + ->orWhere(function($query) { |
|
68 | 68 | $query |
69 | 69 | ->whereNull('lead_type_id') |
70 | - ->whereHas('enrollments', fn ($query) => $query |
|
71 | - ->whereHas('course', function ($q) { |
|
70 | + ->whereHas('enrollments', fn($query) => $query |
|
71 | + ->whereHas('course', function($q) { |
|
72 | 72 | $q->where('period_id', '!=', Period::get_default_period()->id); |
73 | 73 | })) |
74 | - ->whereDoesntHave('enrollments', fn ($query) => $query |
|
75 | - ->whereHas('course', function ($q) { |
|
74 | + ->whereDoesntHave('enrollments', fn($query) => $query |
|
75 | + ->whereHas('course', function($q) { |
|
76 | 76 | $q->where('period_id', Period::get_default_period()->id); |
77 | 77 | })); |
78 | 78 | } |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | |
114 | 114 | return $this->hasMany(Attendance::class) |
115 | 115 | ->where('attendance_type_id', 4) // absence |
116 | - ->whereHas('event', fn ($q) => $q->whereHas('course', fn ($c) => $c->where('period_id', $period->id))); |
|
116 | + ->whereHas('event', fn($q) => $q->whereHas('course', fn($c) => $c->where('period_id', $period->id))); |
|
117 | 117 | } |
118 | 118 | |
119 | 119 | public function periodAttendance(Period $period = null) |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | } |
124 | 124 | |
125 | 125 | return $this->hasMany(Attendance::class) |
126 | - ->whereHas('event', fn ($q) => $q->whereHas('course', fn ($c) => $c->where('period_id', $period->id))); |
|
126 | + ->whereHas('event', fn($q) => $q->whereHas('course', fn($c) => $c->where('period_id', $period->id))); |
|
127 | 127 | } |
128 | 128 | |
129 | 129 | public function contacts() |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | |
202 | 202 | public function getEmailAttribute(): ?string |
203 | 203 | { |
204 | - return $this?->user?->email; |
|
204 | + return $this ? ->user ? ->email; |
|
205 | 205 | } |
206 | 206 | |
207 | 207 | public function getNameAttribute(): string |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | public function getIsEnrolledAttribute() |
235 | 235 | { |
236 | 236 | // if the student is currently enrolled |
237 | - if ($this->enrollments()->whereHas('course', fn ($q) => $q->where('period_id', Period::get_default_period()->id))->count() > 0) { |
|
237 | + if ($this->enrollments()->whereHas('course', fn($q) => $q->where('period_id', Period::get_default_period()->id))->count() > 0) { |
|
238 | 238 | return 1; |
239 | 239 | } |
240 | 240 | } |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | |
25 | 25 | public function getFormattedStartDateAttribute() |
26 | 26 | { |
27 | - if (! $this->started_on) { |
|
27 | + if (!$this->started_on) { |
|
28 | 28 | return '-'; |
29 | 29 | } |
30 | 30 | |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | |
34 | 34 | public function getFormattedEndDateAttribute() |
35 | 35 | { |
36 | - if (! $this->expired_on) { |
|
36 | + if (!$this->expired_on) { |
|
37 | 37 | return '-'; |
38 | 38 | } |
39 | 39 |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | { |
28 | 28 | parent::boot(); |
29 | 29 | |
30 | - static::addGlobalScope('order', function (Builder $builder) { |
|
30 | + static::addGlobalScope('order', function(Builder $builder) { |
|
31 | 31 | $builder->orderBy('year_id')->orderBy('order')->orderBy('id'); |
32 | 32 | }); |
33 | 33 | } |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | { |
177 | 177 | $period = self::where('id', '<', $this->id)->orderBy('id', 'desc')->first(); |
178 | 178 | |
179 | - if (! $period == null) { |
|
179 | + if (!$period == null) { |
|
180 | 180 | return $period; |
181 | 181 | } else { |
182 | 182 | return self::first(); |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | public function getCoursesWithPendingAttendanceAttribute() |
257 | 257 | { |
258 | 258 | // get all courses for period and preload relations |
259 | - $courses = $this->courses()->where(function ($query) { |
|
259 | + $courses = $this->courses()->where(function($query) { |
|
260 | 260 | $query->where('exempt_attendance', '!=', true); |
261 | 261 | $query->where('exempt_attendance', '!=', 1); |
262 | 262 | $query->orWhereNull('exempt_attendance'); |
@@ -20,7 +20,7 @@ |
||
20 | 20 | |
21 | 21 | public $lastname; |
22 | 22 | |
23 | - public function __construct(Student|Contact $user, public $listId) |
|
23 | + public function __construct(Student | Contact $user, public $listId) |
|
24 | 24 | { |
25 | 25 | $this->email = $user->email; |
26 | 26 | $this->name = $user->firstname; |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | } |
59 | 59 | |
60 | 60 | // if no match has been found |
61 | - if (! $matchFound) { |
|
61 | + if (!$matchFound) { |
|
62 | 62 | echo 'no match; creating new eval type'; |
63 | 63 | $evalType = EvaluationType::create(['name' => 'cours '.$entry->course_id]); |
64 | 64 | $evalType->gradeTypes()->sync($courseGradeTypes); |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | } |
86 | 86 | |
87 | 87 | // if no match has been found |
88 | - if (! $matchFound) { |
|
88 | + if (!$matchFound) { |
|
89 | 89 | $levelName = isset($course->level) ? $course->level->name : $course->id; |
90 | 90 | $evalType = EvaluationType::create(['name' => 'Niveau '.$levelName]); |
91 | 91 | $evalType->skills()->sync($courseSkills); |