@@ -26,7 +26,7 @@ |
||
26 | 26 | public function setup() |
27 | 27 | { |
28 | 28 | CRUD::setModel(\App\Models\Profession::class); |
29 | - CRUD::setRoute(config('backpack.base.route_prefix') . '/profession'); |
|
29 | + CRUD::setRoute(config('backpack.base.route_prefix').'/profession'); |
|
30 | 30 | CRUD::setEntityNameStrings('profession', 'professions'); |
31 | 31 | } |
32 | 32 |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | 'label' => trans('backpack::permissionmanager.email'), |
48 | 48 | 'type' => 'email', |
49 | 49 | ], |
50 | - [ // n-n relationship (with pivot table) |
|
50 | + [// n-n relationship (with pivot table) |
|
51 | 51 | 'label' => trans('backpack::permissionmanager.roles'), // Table column heading |
52 | 52 | 'type' => 'select_multiple', |
53 | 53 | 'name' => 'roles', // the method that defines the relationship in your Model |
@@ -66,9 +66,9 @@ discard block |
||
66 | 66 | 'label' => trans('backpack::permissionmanager.role'), |
67 | 67 | ], |
68 | 68 | config('permission.models.role')::all()->pluck(['name', 'id'])->toArray(), |
69 | - function ($value) { |
|
69 | + function($value) { |
|
70 | 70 | // if the filter is active |
71 | - $this->crud->addClause('whereHas', 'roles', function ($query) use ($value) { |
|
71 | + $this->crud->addClause('whereHas', 'roles', function($query) use ($value) { |
|
72 | 72 | $query->where('role_id', '=', $value); |
73 | 73 | }); |
74 | 74 | } |
@@ -119,12 +119,12 @@ discard block |
||
119 | 119 | protected function addFields() |
120 | 120 | { |
121 | 121 | $this->crud->addFields([ |
122 | - [ // Select2 |
|
122 | + [// Select2 |
|
123 | 123 | 'label' => trans('firstname'), |
124 | 124 | 'type' => 'text', |
125 | 125 | 'name' => 'firstname', |
126 | 126 | ], |
127 | - [ // Select2 |
|
127 | + [// Select2 |
|
128 | 128 | 'label' => trans('lastname'), |
129 | 129 | 'type' => 'text', |
130 | 130 | 'name' => 'lastname', |
@@ -27,7 +27,7 @@ |
||
27 | 27 | public function setup() |
28 | 28 | { |
29 | 29 | CRUD::setModel(\App\Models\Tax::class); |
30 | - CRUD::setRoute(config('backpack.base.route_prefix') . '/tax'); |
|
30 | + CRUD::setRoute(config('backpack.base.route_prefix').'/tax'); |
|
31 | 31 | CRUD::setEntityNameStrings('tax', 'taxes'); |
32 | 32 | } |
33 | 33 |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | public function setup() |
28 | 28 | { |
29 | 29 | CRUD::setModel(\App\Models\Partner::class); |
30 | - CRUD::setRoute(config('backpack.base.route_prefix') . '/partner'); |
|
30 | + CRUD::setRoute(config('backpack.base.route_prefix').'/partner'); |
|
31 | 31 | CRUD::setEntityNameStrings(__('partnership'), __('partnerships')); |
32 | 32 | } |
33 | 33 | |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | 'type' => 'date', |
99 | 99 | ]); |
100 | 100 | |
101 | - CRUD::addField([ // Checkbox |
|
101 | + CRUD::addField([// Checkbox |
|
102 | 102 | 'name' => 'auto_renewal', |
103 | 103 | 'label' => __('Tacit renewal'), |
104 | 104 | 'type' => 'checkbox' |
@@ -177,14 +177,14 @@ |
||
177 | 177 | return Scholarship::all()->pluck('name', 'id')->toArray(); |
178 | 178 | }, |
179 | 179 | function ($value) { // if the filter is active |
180 | - if ($value == 'all') { |
|
181 | - CRUD::addClause('whereHas', 'scholarships'); |
|
182 | - } else { |
|
183 | - CRUD::addClause('whereHas', 'scholarships', function ($q) use ($value) { |
|
184 | - $q->where('scholarships.id', $value); |
|
185 | - }); |
|
186 | - } |
|
187 | - } |
|
180 | + if ($value == 'all') { |
|
181 | + CRUD::addClause('whereHas', 'scholarships'); |
|
182 | + } else { |
|
183 | + CRUD::addClause('whereHas', 'scholarships', function ($q) use ($value) { |
|
184 | + $q->where('scholarships.id', $value); |
|
185 | + }); |
|
186 | + } |
|
187 | + } |
|
188 | 188 | ); |
189 | 189 | } |
190 | 190 |
@@ -79,9 +79,9 @@ discard block |
||
79 | 79 | 'attribute' => 'lastname', |
80 | 80 | 'label' => __('Last Name'), |
81 | 81 | 'type' => 'relationship', |
82 | - 'searchLogic' => function ($query, $column, $searchTerm) { |
|
83 | - $query->orWhereHas('student', function ($q) use ($searchTerm) { |
|
84 | - $q->whereHas('user', function ($q) use ($searchTerm) { |
|
82 | + 'searchLogic' => function($query, $column, $searchTerm) { |
|
83 | + $query->orWhereHas('student', function($q) use ($searchTerm) { |
|
84 | + $q->whereHas('user', function($q) use ($searchTerm) { |
|
85 | 85 | $q->where('lastname', 'like', '%'.$searchTerm.'%'); |
86 | 86 | }); |
87 | 87 | }); |
@@ -94,9 +94,9 @@ discard block |
||
94 | 94 | 'attribute' => 'firstname', |
95 | 95 | 'label' => __('First Name'), |
96 | 96 | 'type' => 'relationship', |
97 | - 'searchLogic' => function ($query, $column, $searchTerm) { |
|
98 | - $query->orWhereHas('student', function ($q) use ($searchTerm) { |
|
99 | - $q->whereHas('user', function ($q) use ($searchTerm) { |
|
97 | + 'searchLogic' => function($query, $column, $searchTerm) { |
|
98 | + $query->orWhereHas('student', function($q) use ($searchTerm) { |
|
99 | + $q->whereHas('user', function($q) use ($searchTerm) { |
|
100 | 100 | $q->where('firstname', 'like', '%'.$searchTerm.'%'); |
101 | 101 | }); |
102 | 102 | }); |
@@ -146,10 +146,10 @@ discard block |
||
146 | 146 | 'name' => 'status_id', |
147 | 147 | 'type' => 'select2_multiple', |
148 | 148 | 'label'=> __('Status'), |
149 | - ], function () { |
|
149 | + ], function() { |
|
150 | 150 | return EnrollmentStatusType::all()->pluck('name', 'id')->toArray(); |
151 | 151 | }, |
152 | - function ($values) { |
|
152 | + function($values) { |
|
153 | 153 | // if the filter is active |
154 | 154 | foreach (json_decode($values) as $value) { |
155 | 155 | CRUD::addClause('orWhere', 'status_id', $value); |
@@ -160,9 +160,9 @@ discard block |
||
160 | 160 | 'name' => 'period_id', |
161 | 161 | 'type' => 'select2', |
162 | 162 | 'label'=> __('Period'), |
163 | - ], function () { |
|
163 | + ], function() { |
|
164 | 164 | return Period::all()->pluck('name', 'id')->toArray(); |
165 | - }, function ($value) { |
|
165 | + }, function($value) { |
|
166 | 166 | // if the filter is active |
167 | 167 | CRUD::addClause('period', $value); |
168 | 168 | }); |
@@ -173,14 +173,14 @@ discard block |
||
173 | 173 | 'type' => 'select2', |
174 | 174 | 'label'=> __('Scholarship'), |
175 | 175 | ], |
176 | - function () { |
|
176 | + function() { |
|
177 | 177 | return Scholarship::all()->pluck('name', 'id')->toArray(); |
178 | 178 | }, |
179 | - function ($value) { // if the filter is active |
|
179 | + function($value) { // if the filter is active |
|
180 | 180 | if ($value == 'all') { |
181 | 181 | CRUD::addClause('whereHas', 'scholarships'); |
182 | 182 | } else { |
183 | - CRUD::addClause('whereHas', 'scholarships', function ($q) use ($value) { |
|
183 | + CRUD::addClause('whereHas', 'scholarships', function($q) use ($value) { |
|
184 | 184 | $q->where('scholarships.id', $value); |
185 | 185 | }); |
186 | 186 | } |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | |
207 | 207 | //$enrollment->load('invoices')->load('invoices.payments'); |
208 | 208 | |
209 | - $writeaccess = $enrollment->status_id !== 2 && backpack_user()->can('enrollments.edit'); |
|
209 | + $writeaccess = $enrollment->status_id !== 2 && backpack_user()->can('enrollments.edit'); |
|
210 | 210 | |
211 | 211 | // then load the page |
212 | 212 | return view('enrollments.show', compact('enrollment', 'products', 'comments', 'scholarships', 'availablePaymentMethods', 'writeaccess')); |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | 'model' => "App\Models\Course", // foreign key model |
224 | 224 | 'attribute' => 'name', // foreign key attribute that is shown to user |
225 | 225 | |
226 | - 'options' => (function ($query) { |
|
226 | + 'options' => (function($query) { |
|
227 | 227 | return $query->orderBy('level_id', 'ASC')->where('period_id', $this->crud->getCurrentEntry()->course->period_id)->get(); |
228 | 228 | }), |
229 | 229 | ]); |
@@ -241,7 +241,7 @@ discard block |
||
241 | 241 | ], $currency)); |
242 | 242 | |
243 | 243 | if (config('invoicing.allow_scheduled_payments')) { |
244 | - CRUD::addField(['name' => 'scheduledPayments', 'label' => __('Scheduled Payments'), 'type' => 'repeatable', 'fields' => [['name' => 'date', 'type' => 'date', 'label' => __('Date'), 'wrapper' => ['class' => 'form-group col-md-4'],], array_merge(['name' => 'value', 'type' => 'number', 'attributes' => ["step" => 0.01, "min" => 0], 'label' => __('Value'), 'wrapper' => ['class' => 'form-group col-md-4'],], $currency), ['name' => 'status', 'type' => 'radio', 'label' => __('Status'), 'wrapper' => ['class' => 'form-group col-md-4'], 'options' => [1 => __("Pending"), 2 => __("Paid"),], 'inline' => true,],],]); |
|
244 | + CRUD::addField(['name' => 'scheduledPayments', 'label' => __('Scheduled Payments'), 'type' => 'repeatable', 'fields' => [['name' => 'date', 'type' => 'date', 'label' => __('Date'), 'wrapper' => ['class' => 'form-group col-md-4'], ], array_merge(['name' => 'value', 'type' => 'number', 'attributes' => ["step" => 0.01, "min" => 0], 'label' => __('Value'), 'wrapper' => ['class' => 'form-group col-md-4'], ], $currency), ['name' => 'status', 'type' => 'radio', 'label' => __('Status'), 'wrapper' => ['class' => 'form-group col-md-4'], 'options' => [1 => __("Pending"), 2 => __("Paid"), ], 'inline' => true, ], ], ]); |
|
245 | 245 | } |
246 | 246 | |
247 | 247 | CRUD::addField([ |
@@ -19,7 +19,7 @@ |
||
19 | 19 | { |
20 | 20 | public function create(Enrollment $enrollment) |
21 | 21 | { |
22 | - return view ('invoices.create_scheduled_payments', [ |
|
22 | + return view('invoices.create_scheduled_payments', [ |
|
23 | 23 | 'enrollment' => $enrollment, |
24 | 24 | ]); |
25 | 25 | } |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | |
27 | 27 | $teachers = Teacher::all()->toArray(); |
28 | 28 | |
29 | - $teachers = array_map(function ($teacher) { |
|
29 | + $teachers = array_map(function($teacher) { |
|
30 | 30 | return [ |
31 | 31 | 'id' => $teacher['id'], |
32 | 32 | 'title' => $teacher['name'] ?? '', |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | |
36 | 36 | array_push($teachers, ['id' => 'tbd', 'title' => 'Unassigned']); |
37 | 37 | |
38 | - $events = array_map(function ($event) { |
|
38 | + $events = array_map(function($event) { |
|
39 | 39 | return [ |
40 | 40 | 'title' => $event['name'] ?? '', |
41 | 41 | 'resourceId' => $event['teacher_id'], |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | |
50 | 50 | $unassigned_events = Event::where('teacher_id', null)->get()->toArray(); |
51 | 51 | |
52 | - $unassigned_events = array_map(function ($event) { |
|
52 | + $unassigned_events = array_map(function($event) { |
|
53 | 53 | return [ |
54 | 54 | 'title' => $event['name'] ?? '', |
55 | 55 | 'resourceId' => 'tbd', |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | |
64 | 64 | $leaves = Leave::orderBy('date', 'desc')->limit(10000)->get()->toArray(); |
65 | 65 | |
66 | - $leaves = array_map(function ($event) { |
|
66 | + $leaves = array_map(function($event) { |
|
67 | 67 | return [ |
68 | 68 | 'title' => $event->leaveType->name ?? 'ABS', // todo fix |
69 | 69 | 'resourceId' => $event['teacher_id'], |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | } |
93 | 93 | |
94 | 94 | $events = $teacher->events->toArray(); |
95 | - $events = array_map(function ($event) { |
|
95 | + $events = array_map(function($event) { |
|
96 | 96 | return [ |
97 | 97 | 'title' => $event['name'], |
98 | 98 | 'start' => $event['start'], |
@@ -103,9 +103,9 @@ discard block |
||
103 | 103 | }, $events); |
104 | 104 | |
105 | 105 | $leaves = $teacher->leaves->toArray(); |
106 | - $leaves = array_map(function ($event) { |
|
106 | + $leaves = array_map(function($event) { |
|
107 | 107 | return [ |
108 | - 'title' => $event->leaveType->name ?? 'vacances', // todo fix |
|
108 | + 'title' => $event->leaveType->name ?? 'vacances', // todo fix |
|
109 | 109 | 'start' => $event['date'], |
110 | 110 | 'allDay' => true, |
111 | 111 | ]; |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | { |
11 | 11 | public function get() |
12 | 12 | { |
13 | - if (! backpack_user()->hasPermissionTo('courses.edit')) { |
|
13 | + if (!backpack_user()->hasPermissionTo('courses.edit')) { |
|
14 | 14 | abort(403); |
15 | 15 | } |
16 | 16 | |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | |
24 | 24 | public function update(UpdateConfigRequest $request) |
25 | 25 | { |
26 | - if (! backpack_user()->hasPermissionTo('courses.edit')) { |
|
26 | + if (!backpack_user()->hasPermissionTo('courses.edit')) { |
|
27 | 27 | abort(403); |
28 | 28 | } |
29 | 29 |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | |
87 | 87 | // persist the products |
88 | 88 | foreach ($request->products as $f => $product) { |
89 | - $productType = match ($product['type']) { |
|
89 | + $productType = match($product['type']) { |
|
90 | 90 | 'enrollment' => Enrollment::class, |
91 | 91 | 'scheduledPayment' => Enrollment::class, |
92 | 92 | 'fee' => Fee::class, |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | Payment::create([ |
156 | 156 | 'responsable_id' => backpack_user()->id, |
157 | 157 | 'invoice_id' => $invoice->id, |
158 | - 'payment_method' => isset($payment['method']) ? $payment['method'] : null , |
|
158 | + 'payment_method' => isset($payment['method']) ? $payment['method'] : null, |
|
159 | 159 | 'value' => $payment['value'], |
160 | 160 | 'date' => isset($payment['date']) ? Carbon::parse($payment['date']) : Carbon::now(), |
161 | 161 | ]); |