@@ -86,52 +86,52 @@ |
||
| 86 | 86 | |
| 87 | 87 | ]); |
| 88 | 88 | |
| 89 | - CRUD::addFilter([ // select2 filter |
|
| 89 | + CRUD::addFilter([// select2 filter |
|
| 90 | 90 | 'name' => 'rhythm_id', |
| 91 | 91 | 'type' => 'select2', |
| 92 | 92 | 'label'=> __('Rhythm'), |
| 93 | - ], function () { |
|
| 93 | + ], function() { |
|
| 94 | 94 | return Rhythm::all()->pluck('name', 'id')->toArray(); |
| 95 | - }, function ($value) { // if the filter is active |
|
| 95 | + }, function($value) { // if the filter is active |
|
| 96 | 96 | CRUD::addClause('where', 'rhythm_id', $value); |
| 97 | 97 | }, |
| 98 | - function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
| 98 | + function() { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
| 99 | 99 | }); |
| 100 | 100 | |
| 101 | - CRUD::addFilter([ // select2 filter |
|
| 101 | + CRUD::addFilter([// select2 filter |
|
| 102 | 102 | 'name' => 'teacher_id', |
| 103 | 103 | 'type' => 'select2', |
| 104 | 104 | 'label'=> __('Teacher'), |
| 105 | - ], function () { |
|
| 105 | + ], function() { |
|
| 106 | 106 | return Teacher::all()->pluck('name', 'id')->toArray(); |
| 107 | - }, function ($value) { // if the filter is active |
|
| 107 | + }, function($value) { // if the filter is active |
|
| 108 | 108 | CRUD::addClause('where', 'teacher_id', $value); |
| 109 | 109 | }, |
| 110 | - function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
| 110 | + function() { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
| 111 | 111 | }); |
| 112 | 112 | |
| 113 | - CRUD::addFilter([ // select2 filter |
|
| 113 | + CRUD::addFilter([// select2 filter |
|
| 114 | 114 | 'name' => 'level_id', |
| 115 | 115 | 'type' => 'select2', |
| 116 | 116 | 'label'=> __('Level'), |
| 117 | - ], function () { |
|
| 117 | + ], function() { |
|
| 118 | 118 | return Level::all()->pluck('name', 'id')->toArray(); |
| 119 | - }, function ($value) { // if the filter is active |
|
| 119 | + }, function($value) { // if the filter is active |
|
| 120 | 120 | CRUD::addClause('where', 'level_id', $value); |
| 121 | 121 | }, |
| 122 | - function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
| 122 | + function() { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
| 123 | 123 | }); |
| 124 | 124 | |
| 125 | - CRUD::addFilter([ // select2 filter |
|
| 125 | + CRUD::addFilter([// select2 filter |
|
| 126 | 126 | 'name' => 'period_id', |
| 127 | 127 | 'type' => 'select2', |
| 128 | 128 | 'label'=> __('Period'), |
| 129 | - ], function () { |
|
| 129 | + ], function() { |
|
| 130 | 130 | return Period::all()->sortByDesc('id')->pluck('name', 'id')->toArray(); |
| 131 | - }, function ($value) { // if the filter is active |
|
| 131 | + }, function($value) { // if the filter is active |
|
| 132 | 132 | CRUD::addClause('where', 'period_id', $value); |
| 133 | 133 | }, |
| 134 | - function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
| 134 | + function() { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
| 135 | 135 | $period = Period::get_default_period()->id; |
| 136 | 136 | CRUD::addClause('where', 'period_id', $period); |
| 137 | 137 | $this->crud->getRequest()->request->add(['period_id' => $period]); // to make the filter look active |
@@ -72,25 +72,25 @@ discard block |
||
| 72 | 72 | ], |
| 73 | 73 | ]); |
| 74 | 74 | |
| 75 | - CRUD::addFilter([ // select2 filter |
|
| 75 | + CRUD::addFilter([// select2 filter |
|
| 76 | 76 | 'name' => 'teacher_id', |
| 77 | 77 | 'type' => 'select2', |
| 78 | 78 | 'label'=> __('Teacher'), |
| 79 | - ], function () { |
|
| 79 | + ], function() { |
|
| 80 | 80 | return Teacher::all()->pluck('name', 'id')->toArray(); |
| 81 | - }, function ($value) { // if the filter is active |
|
| 81 | + }, function($value) { // if the filter is active |
|
| 82 | 82 | CRUD::addClause('where', 'teacher_id', $value); |
| 83 | 83 | }, |
| 84 | - function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
| 84 | + function() { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
| 85 | 85 | }); |
| 86 | 86 | |
| 87 | - CRUD::addFilter([ // daterange filter |
|
| 87 | + CRUD::addFilter([// daterange filter |
|
| 88 | 88 | 'type' => 'date_range', |
| 89 | 89 | 'name' => 'from_to', |
| 90 | 90 | 'label'=> __('Date range'), |
| 91 | 91 | ], |
| 92 | 92 | false, |
| 93 | - function ($value) { // if the filter is active, apply these constraints |
|
| 93 | + function($value) { // if the filter is active, apply these constraints |
|
| 94 | 94 | $dates = json_decode($value); |
| 95 | 95 | CRUD::addClause('where', 'date', '>=', $dates->from); |
| 96 | 96 | CRUD::addClause('where', 'date', '<=', $dates->to.' 23:59:59'); |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | 'model' => LeaveType::class, // foreign key model |
| 123 | 123 | ], |
| 124 | 124 | |
| 125 | - [ // date_range |
|
| 125 | + [// date_range |
|
| 126 | 126 | 'name' => ['start_date', 'end_date'], // db columns for start_date & end_date |
| 127 | 127 | 'label' => 'Event Date Range', |
| 128 | 128 | 'type' => 'date_range', |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | 'model' => LeaveType::class, // foreign key model |
| 167 | 167 | ], |
| 168 | 168 | |
| 169 | - [ // datepicker |
|
| 169 | + [// datepicker |
|
| 170 | 170 | 'name' => 'date', |
| 171 | 171 | 'label' => 'Event Date', |
| 172 | 172 | 'type' => 'date', |
@@ -112,13 +112,13 @@ discard block |
||
| 112 | 112 | |
| 113 | 113 | ]); |
| 114 | 114 | |
| 115 | - CRUD::addFilter([ // daterange filter |
|
| 115 | + CRUD::addFilter([// daterange filter |
|
| 116 | 116 | 'type' => 'date_range', |
| 117 | 117 | 'name' => 'from_to', |
| 118 | 118 | 'label'=> __('Date range'), |
| 119 | 119 | ], |
| 120 | 120 | false, |
| 121 | - function ($value) { // if the filter is active, apply these constraints |
|
| 121 | + function($value) { // if the filter is active, apply these constraints |
|
| 122 | 122 | $dates = json_decode($value); |
| 123 | 123 | |
| 124 | 124 | if ($dates->from) { |
@@ -135,10 +135,10 @@ discard block |
||
| 135 | 135 | 'label'=> __('Events with no course'), |
| 136 | 136 | ], |
| 137 | 137 | false, |
| 138 | - function ($value) { // if the filter is active, apply these constraints |
|
| 138 | + function($value) { // if the filter is active, apply these constraints |
|
| 139 | 139 | $this->crud->query->where('course_id', null); |
| 140 | 140 | }, |
| 141 | - function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
| 141 | + function() { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
| 142 | 142 | }); |
| 143 | 143 | |
| 144 | 144 | CRUD::addFilter([ |
@@ -147,20 +147,20 @@ discard block |
||
| 147 | 147 | 'label'=> __('Events with no teacher'), |
| 148 | 148 | ], |
| 149 | 149 | false, |
| 150 | - function ($value) { // if the filter is active, apply these constraints |
|
| 150 | + function($value) { // if the filter is active, apply these constraints |
|
| 151 | 151 | $this->crud->query->where('teacher_id', null); |
| 152 | 152 | }); |
| 153 | 153 | |
| 154 | - CRUD::addFilter([ // select2 filter |
|
| 154 | + CRUD::addFilter([// select2 filter |
|
| 155 | 155 | 'name' => 'teacher_id', |
| 156 | 156 | 'type' => 'select2', |
| 157 | 157 | 'label'=> __('Teacher'), |
| 158 | - ], function () { |
|
| 158 | + ], function() { |
|
| 159 | 159 | return Teacher::all()->pluck('name', 'id')->toArray(); |
| 160 | - }, function ($value) { // if the filter is active |
|
| 160 | + }, function($value) { // if the filter is active |
|
| 161 | 161 | CRUD::addClause('where', 'teacher_id', $value); |
| 162 | 162 | }, |
| 163 | - function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
| 163 | + function() { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
| 164 | 164 | }); |
| 165 | 165 | } |
| 166 | 166 | |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | |
| 49 | 49 | public function teacher(Request $request) |
| 50 | 50 | { |
| 51 | - if (! backpack_user()->isTeacher()) { |
|
| 51 | + if (!backpack_user()->isTeacher()) { |
|
| 52 | 52 | abort(403); |
| 53 | 53 | } |
| 54 | 54 | |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | |
| 68 | 68 | public function student() |
| 69 | 69 | { |
| 70 | - if (! backpack_user()->isStudent()) { |
|
| 70 | + if (!backpack_user()->isStudent()) { |
|
| 71 | 71 | abort(403); |
| 72 | 72 | } |
| 73 | 73 | |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | $currentPeriod = Period::get_default_period(); |
| 86 | 86 | $enrollmentsPeriod = Period::get_enrollments_period(); |
| 87 | 87 | |
| 88 | - if (! backpack_user()->hasRole(['admin', 'secretary'])) { |
|
| 88 | + if (!backpack_user()->hasRole(['admin', 'secretary'])) { |
|
| 89 | 89 | abort(403); |
| 90 | 90 | } |
| 91 | 91 | |
@@ -96,14 +96,14 @@ discard block |
||
| 96 | 96 | |
| 97 | 97 | $teachers = Teacher::with('user')->get()->toArray(); |
| 98 | 98 | |
| 99 | - $teachers = array_map(function ($teacher) { |
|
| 99 | + $teachers = array_map(function($teacher) { |
|
| 100 | 100 | return [ |
| 101 | 101 | 'id' => $teacher['id'], |
| 102 | 102 | 'title' => $teacher['user']['firstname'], |
| 103 | 103 | ]; |
| 104 | 104 | }, $teachers); |
| 105 | 105 | |
| 106 | - $events = array_map(function ($event) { |
|
| 106 | + $events = array_map(function($event) { |
|
| 107 | 107 | return [ |
| 108 | 108 | 'title' => $event['name'], |
| 109 | 109 | 'resourceId' => $event['teacher_id'], |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | 'currentPeriod' => $currentPeriod, |
| 122 | 122 | 'enrollmentsPeriod' => $enrollmentsPeriod, |
| 123 | 123 | 'total_enrollment_count' => $currentPeriod->internal_enrollments_count, |
| 124 | - 'pending_attendance' => $currentPeriod->courses_with_pending_attendance, // optimize |
|
| 124 | + 'pending_attendance' => $currentPeriod->courses_with_pending_attendance, // optimize |
|
| 125 | 125 | 'unassigned_events' => (new Event())->unassigned_teacher->count(), |
| 126 | 126 | 'upcoming_leaves' => Leave::upcoming_leaves(), |
| 127 | 127 | 'resources' => $teachers, |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | 'profession' => 'required', |
| 54 | 54 | 'institution' => 'required', |
| 55 | 55 | 'userPicture' => 'required', |
| 56 | - function ($attribute, $value, $fail) { |
|
| 56 | + function($attribute, $value, $fail) { |
|
| 57 | 57 | $size = strlen(base64_decode($value)); |
| 58 | 58 | |
| 59 | 59 | if ($size > 3145728) { |
@@ -62,13 +62,13 @@ discard block |
||
| 62 | 62 | |
| 63 | 63 | $img = imagecreatefromstring($value); |
| 64 | 64 | |
| 65 | - if (! $img) { |
|
| 65 | + if (!$img) { |
|
| 66 | 66 | $fail($attribute.'Invalid image'); |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | $size = getimagesizefromstring($value); |
| 70 | 70 | |
| 71 | - if (! $size || ($size[0] == 0) || ($size[1] == 0) || ! $size['mime']) { |
|
| 71 | + if (!$size || ($size[0] == 0) || ($size[1] == 0) || !$size['mime']) { |
|
| 72 | 72 | $fail($attribute.'is invalid'); |
| 73 | 73 | } |
| 74 | 74 | }, |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | { |
| 122 | 122 | |
| 123 | 123 | // if registration is closed, deny access |
| 124 | - if (! config('backpack.base.registration_open')) { |
|
| 124 | + if (!config('backpack.base.registration_open')) { |
|
| 125 | 125 | abort(403, trans('backpack::base.registration_closed')); |
| 126 | 126 | } |
| 127 | 127 | |
@@ -29,12 +29,12 @@ |
||
| 29 | 29 | */ |
| 30 | 30 | protected function schedule(Schedule $schedule) |
| 31 | 31 | { |
| 32 | - $schedule->call(function () { |
|
| 32 | + $schedule->call(function() { |
|
| 33 | 33 | Log::info('Sending attendance reminders'); |
| 34 | 34 | (new Attendance())->remindPendingAttendance(); |
| 35 | 35 | })->dailyAt('08:15'); |
| 36 | 36 | |
| 37 | - $schedule->call(function () { |
|
| 37 | + $schedule->call(function() { |
|
| 38 | 38 | Log::info('Checking default periods'); |
| 39 | 39 | |
| 40 | 40 | // when we finish the current period; remove the manual override to automatically fallbackto the next one |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | parent::boot(); |
| 28 | 28 | |
| 29 | 29 | // when creating a new enrollment, also add past attendance |
| 30 | - static::created(function (self $enrollment) { |
|
| 30 | + static::created(function(self $enrollment) { |
|
| 31 | 31 | $events = $enrollment->course->events->where('start', '<', (new Carbon())->toDateString()); |
| 32 | 32 | foreach ($events as $event) { |
| 33 | 33 | $event->attendance()->create([ |
@@ -58,11 +58,11 @@ discard block |
||
| 58 | 58 | public function scopeWithoutChildren($query) |
| 59 | 59 | { |
| 60 | 60 | return $query |
| 61 | - ->where(function ($query) { |
|
| 61 | + ->where(function($query) { |
|
| 62 | 62 | $query->whereDoesntHave('childrenEnrollments') |
| 63 | 63 | ->where('parent_id', null); |
| 64 | 64 | }) |
| 65 | - ->orWhere(function ($query) { |
|
| 65 | + ->orWhere(function($query) { |
|
| 66 | 66 | $query->where('parent_id', null); |
| 67 | 67 | }) |
| 68 | 68 | ->get(); |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | |
| 85 | 85 | public function scopePeriod(Builder $query, $period) |
| 86 | 86 | { |
| 87 | - return $query->whereHas('course', function ($q) use ($period) { |
|
| 87 | + return $query->whereHas('course', function($q) use ($period) { |
|
| 88 | 88 | $q->where('period_id', $period); |
| 89 | 89 | }); |
| 90 | 90 | } |
@@ -293,13 +293,13 @@ discard block |
||
| 293 | 293 | |
| 294 | 294 | // delete attendance records related to the enrollment |
| 295 | 295 | $attendances = $this->course->attendance->where('student_id', $this->student->id); |
| 296 | - Attendance::destroy($attendances->map(function ($item, $key) { |
|
| 296 | + Attendance::destroy($attendances->map(function($item, $key) { |
|
| 297 | 297 | return $item->id; |
| 298 | 298 | })); |
| 299 | 299 | |
| 300 | 300 | foreach ($this->course->children as $child) { |
| 301 | 301 | $attendances = $child->attendance->where('student_id', $this->student->id); |
| 302 | - Attendance::destroy($attendances->map(function ($item, $key) { |
|
| 302 | + Attendance::destroy($attendances->map(function($item, $key) { |
|
| 303 | 303 | return $item->id; |
| 304 | 304 | })); |
| 305 | 305 | } |
@@ -41,7 +41,7 @@ |
||
| 41 | 41 | |
| 42 | 42 | public function search() |
| 43 | 43 | { |
| 44 | - return QueryBuilder::for(Course::class)->where('campus_id', 1) |
|
| 44 | + return QueryBuilder::for (Course::class)->where('campus_id', 1) |
|
| 45 | 45 | ->with('room')->withCount('events')->withCount('children')->withCount('enrollments') |
| 46 | 46 | ->allowedFilters([ |
| 47 | 47 | 'name', |
@@ -10,8 +10,8 @@ |
||
| 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) { |
|
| 14 | - $query->whereIn('level_id', $value)->orWhereHas('children', function (Builder $query) use ($value) { |
|
| 13 | + $query->where(function(Builder $query) use ($value) { |
|
| 14 | + $query->whereIn('level_id', $value)->orWhereHas('children', function(Builder $query) use ($value) { |
|
| 15 | 15 | $query->whereIn('level_id', $value); |
| 16 | 16 | }); |
| 17 | 17 | }); |