Passed
Pull Request — master (#269)
by Thomas
06:04
created
app/Models/Student.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -144,9 +144,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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;
Please login to merge, or discard this patch.
app/Models/Teacher.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -70,22 +70,22 @@  discard block
 block discarded – undo
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
 block discarded – undo
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');
Please login to merge, or discard this patch.
app/Models/Invoice.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -140,22 +140,22 @@  discard block
 block discarded – undo
140 140
             return $this->receipt_number;
141 141
         }
142 142
 
143
-        return $this->invoiceType->name . $this->created_at->format('y') . "-" . $this->invoice_number;
143
+        return $this->invoiceType->name.$this->created_at->format('y')."-".$this->invoice_number;
144 144
     }
145 145
 
146 146
     public function getInvoiceSeriesAttribute() : string
147 147
     {
148
-        return $this->invoiceType->name . $this->created_at->format('y');
148
+        return $this->invoiceType->name.$this->created_at->format('y');
149 149
     }
150 150
 
151 151
     public function getTotalPriceWithCurrencyAttribute()
152 152
     {
153 153
         if (config('app.currency_position') === 'before')
154 154
         {
155
-            return config('app.currency_symbol') . " ". $this->total_price;
155
+            return config('app.currency_symbol')." ".$this->total_price;
156 156
         }
157 157
 
158
-        return $this->total_price . " " . config('app.currency_symbol');
158
+        return $this->total_price." ".config('app.currency_symbol');
159 159
     }
160 160
 
161 161
     public function getTotalPriceAttribute($value)
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
             return $this->receipt_number;
176 176
         }
177 177
 
178
-        return 'FC' . $this->receipt_number;
178
+        return 'FC'.$this->receipt_number;
179 179
     }
180 180
 
181 181
     public function getFormattedDateAttribute()
Please login to merge, or discard this patch.
app/Models/Result.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@
 block discarded – undo
49 49
         parent::boot();
50 50
 
51 51
         // when a result is added, send a notification
52
-        static::saved(function (self $result) {
52
+        static::saved(function(self $result) {
53 53
             Mail::to($result->enrollment->student->user->email)
54 54
             ->locale($result->enrollment->student->user->locale)
55 55
             ->queue(new ResultNotification($result->enrollment->course, $result->enrollment->student->user));
Please login to merge, or discard this patch.
app/Models/InvoiceDetail.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -79,17 +79,17 @@
 block discarded – undo
79 79
 
80 80
     public function getTotalPriceAttribute($value)
81 81
     {
82
-        return ($value * $this->quantity )/ 100;
82
+        return ($value * $this->quantity) / 100;
83 83
     }
84 84
 
85 85
     public function getPriceWithCurrencyAttribute()
86 86
     {
87 87
         if (config('app.currency_position') === 'before')
88 88
         {
89
-            return config('app.currency_symbol') . " ". $this->price;
89
+            return config('app.currency_symbol')." ".$this->price;
90 90
         }
91 91
 
92
-        return $this->price . " " . config('app.currency_symbol');
92
+        return $this->price." ".config('app.currency_symbol');
93 93
     }
94 94
 
95 95
     /*
Please login to merge, or discard this patch.
app/Models/Payment.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -142,10 +142,10 @@
 block discarded – undo
142 142
     {
143 143
         if (config('app.currency_position') === 'before')
144 144
         {
145
-            return config('app.currency_symbol') . " ". $this->value;
145
+            return config('app.currency_symbol')." ".$this->value;
146 146
         }
147 147
 
148
-        return $this->value . " " . config('app.currency_symbol');
148
+        return $this->value." ".config('app.currency_symbol');
149 149
     }
150 150
 
151 151
     public function getDisplayStatusAttribute()
Please login to merge, or discard this patch.
app/Models/ExternalCourse.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -107,7 +107,7 @@
 block discarded – undo
107 107
     {
108 108
         parent::boot();
109 109
 
110
-        static::addGlobalScope('external', function (Builder $builder) {
110
+        static::addGlobalScope('external', function(Builder $builder) {
111 111
             $builder->where('campus_id', 2);
112 112
         });
113 113
     }
Please login to merge, or discard this patch.
app/Traits/FiltersSearchableLevels.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -10,9 +10,9 @@
 block discarded – undo
10 10
     public function __invoke(Builder $query, $value, string $property)
11 11
     {
12 12
         $value = collect($value)->toArray();
13
-        $query->where(function (Builder $query) use ($value) {
13
+        $query->where(function(Builder $query) use ($value) {
14 14
             $query->whereIn('level_id', $value)
15
-                ->orWhereHas('children', function (Builder $query) use ($value) {
15
+                ->orWhereHas('children', function(Builder $query) use ($value) {
16 16
                     $query->whereIn('level_id', $value);
17 17
                 });
18 18
         });
Please login to merge, or discard this patch.
app/Http/Controllers/HomeController.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 
47 47
     public function teacher(Request $request)
48 48
     {
49
-        if (! backpack_user()->isTeacher()) {
49
+        if (!backpack_user()->isTeacher()) {
50 50
             abort(403);
51 51
         }
52 52
 
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 
71 71
     public function student()
72 72
     {
73
-        if (! backpack_user()->isStudent()) {
73
+        if (!backpack_user()->isStudent()) {
74 74
             abort(403);
75 75
         }
76 76
 
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
         $currentPeriod = Period::get_default_period();
89 89
         $enrollmentsPeriod = Period::get_enrollments_period();
90 90
 
91
-        if (! backpack_user()->hasRole(['admin', 'secretary'])) {
91
+        if (!backpack_user()->hasRole(['admin', 'secretary'])) {
92 92
             abort(403);
93 93
         }
94 94
 
@@ -99,14 +99,14 @@  discard block
 block discarded – undo
99 99
 
100 100
         $teachers = Teacher::with('user')->get()->toArray();
101 101
 
102
-        $teachers = array_map(function ($teacher) {
102
+        $teachers = array_map(function($teacher) {
103 103
             return [
104 104
                 'id' => $teacher['id'],
105 105
                 'title' => $teacher['user']['firstname'],
106 106
             ];
107 107
         }, $teachers);
108 108
 
109
-        $events = array_map(function ($event) {
109
+        $events = array_map(function($event) {
110 110
             return [
111 111
                 'title' => $event['name'],
112 112
                 'resourceId' => $event['teacher_id'],
Please login to merge, or discard this patch.