@@ -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); |
@@ -92,7 +92,7 @@ |
||
92 | 92 | 'priceB' => $enrollment->course->price_b, |
93 | 93 | 'priceC' => $enrollment->course->price_c, |
94 | 94 | ]), |
95 | - 'studentPriceCategory' => $enrollment->student?->price_category, |
|
95 | + 'studentPriceCategory' => $enrollment->student ? ->price_category, |
|
96 | 96 | ] |
97 | 97 | ); |
98 | 98 | } |
@@ -91,10 +91,10 @@ discard block |
||
91 | 91 | 'attribute' => 'lastname', // foreign key attribute that is shown to user |
92 | 92 | 'model' => \App\Models\User::class, // foreign key model |
93 | 93 | 'orderable' => true, |
94 | - 'orderLogic' => fn ($query, $column, $columnDirection) => $query->leftJoin('users', 'users.id', '=', 'students.id') |
|
94 | + 'orderLogic' => fn($query, $column, $columnDirection) => $query->leftJoin('users', 'users.id', '=', 'students.id') |
|
95 | 95 | ->orderBy('users.lastname', $columnDirection)->select('students.*'), |
96 | - 'searchLogic' => function ($query, $column, $searchTerm) { |
|
97 | - $query->orWhereHas('user', function ($q) use ($searchTerm) { |
|
96 | + 'searchLogic' => function($query, $column, $searchTerm) { |
|
97 | + $query->orWhereHas('user', function($q) use ($searchTerm) { |
|
98 | 98 | $q->where('lastname', 'like', '%'.$searchTerm.'%'); |
99 | 99 | }); |
100 | 100 | }, |
@@ -109,10 +109,10 @@ discard block |
||
109 | 109 | 'attribute' => 'firstname', // foreign key attribute that is shown to user |
110 | 110 | 'model' => \App\Models\User::class, // foreign key model |
111 | 111 | 'orderable' => true, |
112 | - 'orderLogic' => fn ($query, $column, $columnDirection) => $query->leftJoin('users', 'users.id', '=', 'students.id') |
|
112 | + 'orderLogic' => fn($query, $column, $columnDirection) => $query->leftJoin('users', 'users.id', '=', 'students.id') |
|
113 | 113 | ->orderBy('users.firstname', $columnDirection)->select('students.*'), |
114 | - 'searchLogic' => function ($query, $column, $searchTerm) { |
|
115 | - $query->orWhereHas('user', function ($q) use ($searchTerm) { |
|
114 | + 'searchLogic' => function($query, $column, $searchTerm) { |
|
115 | + $query->orWhereHas('user', function($q) use ($searchTerm) { |
|
116 | 116 | $q->where('firstname', 'like', '%'.$searchTerm.'%'); |
117 | 117 | }); |
118 | 118 | }, |
@@ -126,10 +126,10 @@ discard block |
||
126 | 126 | 'attribute' => 'email', // foreign key attribute that is shown to user |
127 | 127 | 'model' => \App\Models\User::class, // foreign key model |
128 | 128 | 'orderable' => true, |
129 | - 'orderLogic' => fn ($query, $column, $columnDirection) => $query->leftJoin('users', 'users.id', '=', 'students.id') |
|
129 | + 'orderLogic' => fn($query, $column, $columnDirection) => $query->leftJoin('users', 'users.id', '=', 'students.id') |
|
130 | 130 | ->orderBy('users.email', $columnDirection)->select('students.*'), |
131 | - 'searchLogic' => function ($query, $column, $searchTerm) { |
|
132 | - $query->orWhereHas('user', function ($q) use ($searchTerm) { |
|
131 | + 'searchLogic' => function($query, $column, $searchTerm) { |
|
132 | + $query->orWhereHas('user', function($q) use ($searchTerm) { |
|
133 | 133 | $q->where('email', 'like', '%'.$searchTerm.'%'); |
134 | 134 | }); |
135 | 135 | }, |
@@ -175,25 +175,25 @@ discard block |
||
175 | 175 | |
176 | 176 | ]); |
177 | 177 | |
178 | - CRUD::addFilter([ // select2 filter |
|
178 | + CRUD::addFilter([// select2 filter |
|
179 | 179 | 'name' => 'enrolled', |
180 | 180 | 'type' => 'select2', |
181 | 181 | 'label'=> __('Is Enrolled in'), |
182 | - ], fn () => Period::all()->pluck('name', 'id')->toArray(), function ($value) { // if the filter is active |
|
183 | - $this->crud->query = $this->crud->query->whereHas('enrollments', fn ($query) => $query->whereHas('course', function ($q) use ($value) { |
|
182 | + ], fn() => Period::all()->pluck('name', 'id')->toArray(), function($value) { // if the filter is active |
|
183 | + $this->crud->query = $this->crud->query->whereHas('enrollments', fn($query) => $query->whereHas('course', function($q) use ($value) { |
|
184 | 184 | $q->where('period_id', $value); |
185 | 185 | })); |
186 | 186 | }, |
187 | - function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
187 | + function() { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
188 | 188 | }); |
189 | 189 | |
190 | - CRUD::addFilter([ // select2_multiple filter |
|
190 | + CRUD::addFilter([// select2_multiple filter |
|
191 | 191 | 'name' => 'notenrolled', |
192 | 192 | 'type' => 'select2_multiple', |
193 | 193 | 'label'=> __('Is Not Enrolled in'), |
194 | - ], fn () => Period::all()->pluck('name', 'id')->toArray(), function ($values) { // if the filter is active |
|
194 | + ], fn() => Period::all()->pluck('name', 'id')->toArray(), function($values) { // if the filter is active |
|
195 | 195 | foreach (json_decode($values, null, 512, JSON_THROW_ON_ERROR) as $value) { |
196 | - $this->crud->query = $this->crud->query->whereDoesntHave('enrollments', fn ($query) => $query->whereHas('course', function ($q) use ($value) { |
|
196 | + $this->crud->query = $this->crud->query->whereDoesntHave('enrollments', fn($query) => $query->whereHas('course', function($q) use ($value) { |
|
197 | 197 | $q->where('period_id', $value); |
198 | 198 | })); |
199 | 199 | } |
@@ -204,8 +204,8 @@ discard block |
||
204 | 204 | 'type' => 'select2', |
205 | 205 | 'label'=> __('New In'), |
206 | 206 | ], |
207 | - fn () => Period::all()->pluck('name', 'id')->toArray(), |
|
208 | - function ($value) { // if the filter is active |
|
207 | + fn() => Period::all()->pluck('name', 'id')->toArray(), |
|
208 | + function($value) { // if the filter is active |
|
209 | 209 | CRUD::addClause('newInPeriod', $value); |
210 | 210 | } |
211 | 211 | ); |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | 'name' => 'institution_id', |
216 | 216 | 'type' => 'select2', |
217 | 217 | 'label' => __('Institution'), |
218 | - ], fn () => Institution::all()->pluck('name', 'id')->toArray(), function ($value) { // if the filter is active |
|
218 | + ], fn() => Institution::all()->pluck('name', 'id')->toArray(), function($value) { // if the filter is active |
|
219 | 219 | $this->crud->addClause('where', 'institution_id', $value); |
220 | 220 | }); |
221 | 221 | |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | 'name' => 'status_type_id', |
224 | 224 | 'type' => 'select2', |
225 | 225 | 'label' => __('Lead Status'), |
226 | - ], fn () => LeadType::all()->pluck('name', 'id')->toArray(), function ($value) { |
|
226 | + ], fn() => LeadType::all()->pluck('name', 'id')->toArray(), function($value) { |
|
227 | 227 | if ($value === '4') { |
228 | 228 | $this->crud->query = $this->crud->query->where('lead_type_id', $value)->orWhere('lead_type_id', null); |
229 | 229 | } else { |
@@ -318,8 +318,8 @@ discard block |
||
318 | 318 | $username_parts = array_filter(explode(' ', strtolower($fullName))); |
319 | 319 | $username_parts = array_slice($username_parts, -2); |
320 | 320 | |
321 | - $part1 = (! empty($username_parts[0])) ? substr($username_parts[0], 0, 3) : ''; |
|
322 | - $part2 = (! empty($username_parts[1])) ? substr($username_parts[1], 0, 8) : ''; |
|
321 | + $part1 = (!empty($username_parts[0])) ? substr($username_parts[0], 0, 3) : ''; |
|
322 | + $part2 = (!empty($username_parts[1])) ? substr($username_parts[1], 0, 8) : ''; |
|
323 | 323 | $part3 = random_int(999, 9999); |
324 | 324 | |
325 | 325 | $username = $part1.$part2.$part3; //str_shuffle to randomly shuffle all characters |
@@ -407,7 +407,7 @@ discard block |
||
407 | 407 | { |
408 | 408 | $student = Student::findOrFail($student); |
409 | 409 | |
410 | - if (! backpack_user()->isTeacher() && ! backpack_user()->can('enrollments.view')) { |
|
410 | + if (!backpack_user()->isTeacher() && !backpack_user()->can('enrollments.view')) { |
|
411 | 411 | abort(403); |
412 | 412 | } |
413 | 413 |