@@ -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 | |
@@ -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 | |
@@ -38,7 +38,7 @@ |
||
| 38 | 38 | { |
| 39 | 39 | $period = Period::get_default_period(); |
| 40 | 40 | |
| 41 | - if (! isset($request->period)) { |
|
| 41 | + if (!isset($request->period)) { |
|
| 42 | 42 | $startperiod = Period::find(Config::where('name', 'first_period')->first()->value); |
| 43 | 43 | } else { |
| 44 | 44 | $startperiod = Period::find($request->period); |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | public function update(Contact $contact, Request $request) |
| 58 | 58 | { |
| 59 | 59 | // check if the user is allowed to edit the contact |
| 60 | - if (! backpack_user()->can('update', $contact)) { |
|
| 60 | + if (!backpack_user()->can('update', $contact)) { |
|
| 61 | 61 | abort(403); |
| 62 | 62 | } |
| 63 | 63 | |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | public function edit(Contact $contact) |
| 96 | 96 | { |
| 97 | 97 | // check if the user is allowed to edit the contact |
| 98 | - if (! backpack_user()->can('update', $contact)) { |
|
| 98 | + if (!backpack_user()->can('update', $contact)) { |
|
| 99 | 99 | abort(403); |
| 100 | 100 | } |
| 101 | 101 | |
@@ -54,7 +54,7 @@ |
||
| 54 | 54 | CRUD::addFields([ |
| 55 | 55 | ['name' => 'name', 'label' => 'Name', 'type' => 'text'], |
| 56 | 56 | ['name' => 'total', 'label' => 'Total', 'type' => 'text'], |
| 57 | - [ // Select |
|
| 57 | + [// Select |
|
| 58 | 58 | 'label' => 'Category', |
| 59 | 59 | 'type' => 'select', |
| 60 | 60 | 'name' => 'grade_type_category_id', // the db column for the foreign key |
@@ -32,7 +32,7 @@ |
||
| 32 | 32 | $this->crud->allowAccess('showstudentphotoroster'); |
| 33 | 33 | $this->crud->setOperationSetting('setFromDb', true); |
| 34 | 34 | |
| 35 | - $this->crud->operation('showstudentphotoroster', function () { |
|
| 35 | + $this->crud->operation('showstudentphotoroster', function() { |
|
| 36 | 36 | $this->crud->loadDefaultOperationSettingsFromConfig(); |
| 37 | 37 | }); |
| 38 | 38 | |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | 'label' => trans('backpack::permissionmanager.email'), |
| 42 | 42 | 'type' => 'email', |
| 43 | 43 | ], |
| 44 | - [ // n-n relationship (with pivot table) |
|
| 44 | + [// n-n relationship (with pivot table) |
|
| 45 | 45 | 'label' => trans('backpack::permissionmanager.roles'), // Table column heading |
| 46 | 46 | 'type' => 'select_multiple', |
| 47 | 47 | 'name' => 'roles', // the method that defines the relationship in your Model |
@@ -60,8 +60,8 @@ discard block |
||
| 60 | 60 | 'label' => trans('backpack::permissionmanager.role'), |
| 61 | 61 | ], |
| 62 | 62 | config('permission.models.role')::all()->pluck('name', 'id')->toArray(), |
| 63 | - function ($value) { // if the filter is active |
|
| 64 | - $this->crud->addClause('whereHas', 'roles', function ($query) use ($value) { |
|
| 63 | + function($value) { // if the filter is active |
|
| 64 | + $this->crud->addClause('whereHas', 'roles', function($query) use ($value) { |
|
| 65 | 65 | $query->where('role_id', '=', $value); |
| 66 | 66 | }); |
| 67 | 67 | } |
@@ -114,12 +114,12 @@ discard block |
||
| 114 | 114 | protected function addFields() |
| 115 | 115 | { |
| 116 | 116 | $this->crud->addFields([ |
| 117 | - [ // Select2 |
|
| 117 | + [// Select2 |
|
| 118 | 118 | 'label' => trans('firstname'), |
| 119 | 119 | 'type' => 'text', |
| 120 | 120 | 'name' => 'firstname', |
| 121 | 121 | ], |
| 122 | - [ // Select2 |
|
| 122 | + [// Select2 |
|
| 123 | 123 | 'label' => trans('lastname'), |
| 124 | 124 | 'type' => 'text', |
| 125 | 125 | 'name' => 'lastname', |
@@ -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', |
@@ -62,12 +62,12 @@ discard block |
||
| 62 | 62 | 'attribute' => 'lastname', // foreign key attribute that is shown to user |
| 63 | 63 | 'model' => 'App\Models\User', // foreign key model |
| 64 | 64 | 'orderable' => true, |
| 65 | - 'orderLogic' => function ($query, $column, $columnDirection) { |
|
| 65 | + 'orderLogic' => function($query, $column, $columnDirection) { |
|
| 66 | 66 | return $query->leftJoin('users', 'users.id', '=', 'students.user_id') |
| 67 | 67 | ->orderBy('users.lastname', $columnDirection)->select('students.*'); |
| 68 | 68 | }, |
| 69 | - 'searchLogic' => function ($query, $column, $searchTerm) { |
|
| 70 | - $query->orWhereHas('user', function ($q) use ($searchTerm) { |
|
| 69 | + 'searchLogic' => function($query, $column, $searchTerm) { |
|
| 70 | + $query->orWhereHas('user', function($q) use ($searchTerm) { |
|
| 71 | 71 | $q->where('lastname', 'like', '%'.$searchTerm.'%'); |
| 72 | 72 | }); |
| 73 | 73 | }, |
@@ -82,12 +82,12 @@ discard block |
||
| 82 | 82 | 'attribute' => 'firstname', // foreign key attribute that is shown to user |
| 83 | 83 | 'model' => 'App\Models\User', // foreign key model |
| 84 | 84 | 'orderable' => true, |
| 85 | - 'orderLogic' => function ($query, $column, $columnDirection) { |
|
| 85 | + 'orderLogic' => function($query, $column, $columnDirection) { |
|
| 86 | 86 | return $query->leftJoin('users', 'users.id', '=', 'students.user_id') |
| 87 | 87 | ->orderBy('users.firstname', $columnDirection)->select('students.*'); |
| 88 | 88 | }, |
| 89 | - 'searchLogic' => function ($query, $column, $searchTerm) { |
|
| 90 | - $query->orWhereHas('user', function ($q) use ($searchTerm) { |
|
| 89 | + 'searchLogic' => function($query, $column, $searchTerm) { |
|
| 90 | + $query->orWhereHas('user', function($q) use ($searchTerm) { |
|
| 91 | 91 | $q->where('firstname', 'like', '%'.$searchTerm.'%'); |
| 92 | 92 | }); |
| 93 | 93 | }, |
@@ -102,12 +102,12 @@ discard block |
||
| 102 | 102 | 'attribute' => 'email', // foreign key attribute that is shown to user |
| 103 | 103 | 'model' => 'App\Models\User', // foreign key model |
| 104 | 104 | 'orderable' => true, |
| 105 | - 'orderLogic' => function ($query, $column, $columnDirection) { |
|
| 105 | + 'orderLogic' => function($query, $column, $columnDirection) { |
|
| 106 | 106 | return $query->leftJoin('users', 'users.id', '=', 'students.user_id') |
| 107 | 107 | ->orderBy('users.email', $columnDirection)->select('students.*'); |
| 108 | 108 | }, |
| 109 | - 'searchLogic' => function ($query, $column, $searchTerm) { |
|
| 110 | - $query->orWhereHas('user', function ($q) use ($searchTerm) { |
|
| 109 | + 'searchLogic' => function($query, $column, $searchTerm) { |
|
| 110 | + $query->orWhereHas('user', function($q) use ($searchTerm) { |
|
| 111 | 111 | $q->where('email', 'like', '%'.$searchTerm.'%'); |
| 112 | 112 | }); |
| 113 | 113 | }, |
@@ -125,32 +125,32 @@ discard block |
||
| 125 | 125 | |
| 126 | 126 | ]); |
| 127 | 127 | |
| 128 | - CRUD::addFilter([ // select2 filter |
|
| 128 | + CRUD::addFilter([// select2 filter |
|
| 129 | 129 | 'name' => 'enrolled', |
| 130 | 130 | 'type' => 'select2', |
| 131 | 131 | 'label'=> __('Is Enrolled in'), |
| 132 | - ], function () { |
|
| 132 | + ], function() { |
|
| 133 | 133 | return Period::all()->pluck('name', 'id')->toArray(); |
| 134 | - }, function ($value) { // if the filter is active |
|
| 135 | - $this->crud->query = $this->crud->query->whereHas('enrollments', function ($query) use ($value) { |
|
| 136 | - return $query->whereHas('course', function ($q) use ($value) { |
|
| 134 | + }, function($value) { // if the filter is active |
|
| 135 | + $this->crud->query = $this->crud->query->whereHas('enrollments', function($query) use ($value) { |
|
| 136 | + return $query->whereHas('course', function($q) use ($value) { |
|
| 137 | 137 | $q->where('period_id', $value); |
| 138 | 138 | }); |
| 139 | 139 | }); |
| 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 | - CRUD::addFilter([ // select2_multiple filter |
|
| 144 | + CRUD::addFilter([// select2_multiple filter |
|
| 145 | 145 | 'name' => 'notenrolled', |
| 146 | 146 | 'type' => 'select2_multiple', |
| 147 | 147 | 'label'=> __('Is Not Enrolled in'), |
| 148 | - ], function () { // the options that show up in the select2 |
|
| 148 | + ], function() { // the options that show up in the select2 |
|
| 149 | 149 | return Period::all()->pluck('name', 'id')->toArray(); |
| 150 | - }, function ($values) { // if the filter is active |
|
| 150 | + }, function($values) { // if the filter is active |
|
| 151 | 151 | foreach (json_decode($values) as $key => $value) { |
| 152 | - $this->crud->query = $this->crud->query->whereDoesntHave('enrollments', function ($query) use ($value) { |
|
| 153 | - return $query->whereHas('course', function ($q) use ($value) { |
|
| 152 | + $this->crud->query = $this->crud->query->whereDoesntHave('enrollments', function($query) use ($value) { |
|
| 153 | + return $query->whereHas('course', function($q) use ($value) { |
|
| 154 | 154 | $q->where('period_id', $value); |
| 155 | 155 | }); |
| 156 | 156 | }); |
@@ -162,9 +162,9 @@ discard block |
||
| 162 | 162 | 'name' => 'institution_id', |
| 163 | 163 | 'type' => 'select2', |
| 164 | 164 | 'label' => __('Institution'), |
| 165 | - ], function () { |
|
| 165 | + ], function() { |
|
| 166 | 166 | return Institution::all()->pluck('name', 'id')->toArray(); |
| 167 | - }, function ($value) { // if the filter is active |
|
| 167 | + }, function($value) { // if the filter is active |
|
| 168 | 168 | $this->crud->addClause('where', 'institution_id', $value); |
| 169 | 169 | }); |
| 170 | 170 | } |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | { |
| 174 | 174 | $student = Student::findOrFail($student); |
| 175 | 175 | |
| 176 | - if (! backpack_user()->isTeacher() && ! backpack_user()->can('enrollments.view')) { |
|
| 176 | + if (!backpack_user()->isTeacher() && !backpack_user()->can('enrollments.view')) { |
|
| 177 | 177 | abort(403); |
| 178 | 178 | } |
| 179 | 179 | |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | { |
| 64 | 64 | CRUD::setValidation(StoreRequest::class); |
| 65 | 65 | CRUD::addFields([ |
| 66 | - [ // Select2 |
|
| 66 | + [// Select2 |
|
| 67 | 67 | 'label' => 'User', |
| 68 | 68 | 'type' => 'select2', |
| 69 | 69 | 'name' => 'user_id', // the db column for the foreign key |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | protected function setupUpdateOperation() |
| 89 | 89 | { |
| 90 | 90 | CRUD::addFields([ |
| 91 | - [ // Select2 |
|
| 91 | + [// Select2 |
|
| 92 | 92 | 'label' => 'User', |
| 93 | 93 | 'type' => 'select2', |
| 94 | 94 | 'name' => 'user_id', // the db column for the foreign key |
@@ -29,10 +29,10 @@ |
||
| 29 | 29 | $this->crud->replaceSaveActions( |
| 30 | 30 | [ |
| 31 | 31 | 'name' => __('Save and go back'), |
| 32 | - 'visible' => function ($crud) { |
|
| 32 | + 'visible' => function($crud) { |
|
| 33 | 33 | return true; |
| 34 | 34 | }, |
| 35 | - 'redirect' => function ($crud, $request, $itemId) { |
|
| 35 | + 'redirect' => function($crud, $request, $itemId) { |
|
| 36 | 36 | $enrollment_id = Payment::find($itemId)->enrollment_id; |
| 37 | 37 | |
| 38 | 38 | return route('enrollment.show', ['id' => $enrollment_id]); |