@@ -208,8 +208,8 @@ |
||
| 208 | 208 | foreach ($course->enrollments as $enrollment) { |
| 209 | 209 | // if a student has no attendance record for the class (event) |
| 210 | 210 | $hasNotAttended = $course->attendance->where('student_id', $enrollment->student_id) |
| 211 | - ->where('event_id', $event->id) |
|
| 212 | - ->isEmpty(); |
|
| 211 | + ->where('event_id', $event->id) |
|
| 212 | + ->isEmpty(); |
|
| 213 | 213 | |
| 214 | 214 | // count one and break loop |
| 215 | 215 | if ($hasNotAttended) { |
@@ -55,7 +55,8 @@ discard block |
||
| 55 | 55 | |
| 56 | 56 | public function search() |
| 57 | 57 | { |
| 58 | - return QueryBuilder::for(Course::class)->where('campus_id', 1) |
|
| 58 | + return QueryBuilder::for(Course::class) { |
|
| 59 | + ->where('campus_id', 1) |
|
| 59 | 60 | ->with('room')->withCount('events')->withCount('children') |
| 60 | 61 | ->allowedFilters([ |
| 61 | 62 | 'name', |
@@ -64,5 +65,6 @@ discard block |
||
| 64 | 65 | AllowedFilter::custom('searchable_levels', new FiltersSearchableLevels), |
| 65 | 66 | 'teacher_id', ]) |
| 66 | 67 | ->get(); |
| 68 | + } |
|
| 67 | 69 | } |
| 68 | 70 | } |
@@ -226,8 +226,8 @@ |
||
| 226 | 226 | $user = Student::where('user_id', $this->guard()->user()->id)->first(); |
| 227 | 227 | |
| 228 | 228 | $user |
| 229 | - ->addMedia($request->fileToUpload) |
|
| 230 | - ->toMediaCollection('profile-picture'); |
|
| 229 | + ->addMedia($request->fileToUpload) |
|
| 230 | + ->toMediaCollection('profile-picture'); |
|
| 231 | 231 | } |
| 232 | 232 | |
| 233 | 233 | // if the user has been selected for a forced update, move to the next step |
@@ -163,9 +163,9 @@ |
||
| 163 | 163 | // add photo |
| 164 | 164 | |
| 165 | 165 | $student |
| 166 | - ->addMediaFromBase64($request->data['userPicture']) |
|
| 167 | - ->usingFileName('profilePicture.jpg') |
|
| 168 | - ->toMediaCollection('profile-picture'); |
|
| 166 | + ->addMediaFromBase64($request->data['userPicture']) |
|
| 167 | + ->usingFileName('profilePicture.jpg') |
|
| 168 | + ->toMediaCollection('profile-picture'); |
|
| 169 | 169 | |
| 170 | 170 | Log::info('Profile picture added to the student profile'); |
| 171 | 171 | |
@@ -87,8 +87,8 @@ discard block |
||
| 87 | 87 | }, function ($value) { // if the filter is active |
| 88 | 88 | CRUD::addClause('where', 'rhythm_id', $value); |
| 89 | 89 | }, |
| 90 | - function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
| 91 | - }); |
|
| 90 | + function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
| 91 | + }); |
|
| 92 | 92 | |
| 93 | 93 | CRUD::addFilter([ // select2 filter |
| 94 | 94 | 'name' => 'teacher_id', |
@@ -99,8 +99,8 @@ discard block |
||
| 99 | 99 | }, function ($value) { // if the filter is active |
| 100 | 100 | CRUD::addClause('where', 'teacher_id', $value); |
| 101 | 101 | }, |
| 102 | - function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
| 103 | - }); |
|
| 102 | + function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
| 103 | + }); |
|
| 104 | 104 | |
| 105 | 105 | CRUD::addFilter([ // select2 filter |
| 106 | 106 | 'name' => 'level_id', |
@@ -111,8 +111,8 @@ discard block |
||
| 111 | 111 | }, function ($value) { // if the filter is active |
| 112 | 112 | CRUD::addClause('where', 'level_id', $value); |
| 113 | 113 | }, |
| 114 | - function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
| 115 | - }); |
|
| 114 | + function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
| 115 | + }); |
|
| 116 | 116 | |
| 117 | 117 | CRUD::addFilter([ // select2 filter |
| 118 | 118 | 'name' => 'period_id', |
@@ -123,11 +123,11 @@ discard block |
||
| 123 | 123 | }, function ($value) { // if the filter is active |
| 124 | 124 | CRUD::addClause('where', 'period_id', $value); |
| 125 | 125 | }, |
| 126 | - function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
| 127 | - $period = \App\Models\Period::get_default_period()->id; |
|
| 128 | - CRUD::addClause('where', 'period_id', $period); |
|
| 129 | - $this->crud->getRequest()->request->add(['period_id' => $period]); // to make the filter look active |
|
| 130 | - }); |
|
| 126 | + function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
| 127 | + $period = \App\Models\Period::get_default_period()->id; |
|
| 128 | + CRUD::addClause('where', 'period_id', $period); |
|
| 129 | + $this->crud->getRequest()->request->add(['period_id' => $period]); // to make the filter look active |
|
| 130 | + }); |
|
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | protected function setupCreateOperation() |
@@ -136,8 +136,8 @@ |
||
| 136 | 136 | }); |
| 137 | 137 | }); |
| 138 | 138 | }, |
| 139 | - function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
| 140 | - }); |
|
| 139 | + function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
| 140 | + }); |
|
| 141 | 141 | |
| 142 | 142 | CRUD::addFilter([ // select2_multiple filter |
| 143 | 143 | 'name' => 'notenrolled', |
@@ -86,10 +86,10 @@ discard block |
||
| 86 | 86 | 'name' => 'action', |
| 87 | 87 | 'label'=> 'Action', |
| 88 | 88 | ], |
| 89 | - false, |
|
| 90 | - function () { // if the filter is active |
|
| 91 | - CRUD::addClause('where', 'action', true); |
|
| 92 | - }); |
|
| 89 | + false, |
|
| 90 | + function () { // if the filter is active |
|
| 91 | + CRUD::addClause('where', 'action', true); |
|
| 92 | + }); |
|
| 93 | 93 | |
| 94 | 94 | CRUD::addFilter([ // dropdown filter |
| 95 | 95 | 'name' => 'type', |
@@ -103,10 +103,10 @@ discard block |
||
| 103 | 103 | ], function ($value) { // if the filter is active |
| 104 | 104 | CRUD::addClause('where', 'commentable_type', '=', $value); |
| 105 | 105 | }, |
| 106 | - function () { // if the filter is not active |
|
| 107 | - CRUD::addClause('where', 'commentable_type', '=', \App\Models\Student::class); |
|
| 108 | - $this->crud->getRequest()->request->add(['commentable_type' => \App\Models\Student::class]); // to make the filter look active |
|
| 109 | - }); |
|
| 106 | + function () { // if the filter is not active |
|
| 107 | + CRUD::addClause('where', 'commentable_type', '=', \App\Models\Student::class); |
|
| 108 | + $this->crud->getRequest()->request->add(['commentable_type' => \App\Models\Student::class]); // to make the filter look active |
|
| 109 | + }); |
|
| 110 | 110 | } |
| 111 | 111 | |
| 112 | 112 | public function setupUpdateOperation() |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | $q->where('firstname', 'like', '%'.$searchTerm.'%') |
| 53 | 53 | ->orWhere('lastname', 'like', '%'.$searchTerm.'%') |
| 54 | 54 | ->orWhere('email', 'like', '%'.$searchTerm.'%') |
| 55 | - ->orWhere('idnumber', 'like', '%'.$searchTerm.'%'); |
|
| 55 | + ->orWhere('idnumber', 'like', '%'.$searchTerm.'%'); |
|
| 56 | 56 | }); |
| 57 | 57 | }); |
| 58 | 58 | }, |
@@ -86,20 +86,20 @@ discard block |
||
| 86 | 86 | 'name' => 'noresult', |
| 87 | 87 | 'label'=> __('No Result'), |
| 88 | 88 | ], |
| 89 | - false, |
|
| 90 | - function () { |
|
| 91 | - CRUD::addClause('noResult'); |
|
| 92 | - }); |
|
| 89 | + false, |
|
| 90 | + function () { |
|
| 91 | + CRUD::addClause('noResult'); |
|
| 92 | + }); |
|
| 93 | 93 | |
| 94 | 94 | CRUD::addFilter([ |
| 95 | 95 | 'type' => 'simple', |
| 96 | 96 | 'name' => 'hideparents', |
| 97 | 97 | 'label'=> __('Hide Parents'), |
| 98 | 98 | ], |
| 99 | - false, |
|
| 100 | - function () { |
|
| 101 | - CRUD::addClause('real'); |
|
| 102 | - }); |
|
| 99 | + false, |
|
| 100 | + function () { |
|
| 101 | + CRUD::addClause('real'); |
|
| 102 | + }); |
|
| 103 | 103 | |
| 104 | 104 | CRUD::addFilter([ |
| 105 | 105 | 'name' => 'period_id', |
@@ -75,20 +75,20 @@ |
||
| 75 | 75 | }, function ($value) { // if the filter is active |
| 76 | 76 | CRUD::addClause('where', 'teacher_id', $value); |
| 77 | 77 | }, |
| 78 | - function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
| 79 | - }); |
|
| 78 | + function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
| 79 | + }); |
|
| 80 | 80 | |
| 81 | 81 | CRUD::addFilter([ // daterange filter |
| 82 | 82 | 'type' => 'date_range', |
| 83 | 83 | 'name' => 'from_to', |
| 84 | 84 | 'label'=> __('Date range'), |
| 85 | 85 | ], |
| 86 | - false, |
|
| 87 | - function ($value) { // if the filter is active, apply these constraints |
|
| 88 | - $dates = json_decode($value); |
|
| 89 | - CRUD::addClause('where', 'date', '>=', $dates->from); |
|
| 90 | - CRUD::addClause('where', 'date', '<=', $dates->to.' 23:59:59'); |
|
| 91 | - }); |
|
| 86 | + false, |
|
| 87 | + function ($value) { // if the filter is active, apply these constraints |
|
| 88 | + $dates = json_decode($value); |
|
| 89 | + CRUD::addClause('where', 'date', '>=', $dates->from); |
|
| 90 | + CRUD::addClause('where', 'date', '<=', $dates->to.' 23:59:59'); |
|
| 91 | + }); |
|
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | protected function setupCreateOperation() |