@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | { |
| 36 | 36 | CRUD::addField(['name' => 'name', 'label' => 'Name', 'type' => 'text']); |
| 37 | 37 | |
| 38 | - CRUD::addField([ // Select2Multiple = n-n relationship (with pivot table) |
|
| 38 | + CRUD::addField([// Select2Multiple = n-n relationship (with pivot table) |
|
| 39 | 39 | 'label' => __('Grade Types'), |
| 40 | 40 | 'type' => 'select2_multiple', |
| 41 | 41 | 'name' => 'gradeTypes', // the method that defines the relationship in your Model |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | 'select_all' => true, // show Select All and Clear buttons? |
| 49 | 49 | ]); |
| 50 | 50 | |
| 51 | - CRUD::addField([ // Select2Multiple = n-n relationship (with pivot table) |
|
| 51 | + CRUD::addField([// Select2Multiple = n-n relationship (with pivot table) |
|
| 52 | 52 | 'label' => __('Skills'), |
| 53 | 53 | 'type' => 'select2_multiple', |
| 54 | 54 | 'name' => 'skills', // the method that defines the relationship in your Model |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | public function setup() |
| 36 | 36 | { |
| 37 | 37 | CRUD::setModel(\App\Models\Payment::class); |
| 38 | - CRUD::setRoute(config('backpack.base.route_prefix') . '/payment'); |
|
| 38 | + CRUD::setRoute(config('backpack.base.route_prefix').'/payment'); |
|
| 39 | 39 | CRUD::setEntityNameStrings('payment', 'payments'); |
| 40 | 40 | |
| 41 | 41 | $this->crud->enableExportButtons(); |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | 'label' => __('Due Date'), |
| 55 | 55 | ], |
| 56 | 56 | false, |
| 57 | - function ($value) { // if the filter is active, apply these constraints |
|
| 57 | + function($value) { // if the filter is active, apply these constraints |
|
| 58 | 58 | $this->crud->addClause('where', 'date', '>=', Carbon::parse($value)->firstOfMonth()); |
| 59 | 59 | $this->crud->addClause('where', 'date', '<=', Carbon::parse($value)->lastOfMonth()); |
| 60 | 60 | }); |
@@ -95,11 +95,11 @@ discard block |
||
| 95 | 95 | { |
| 96 | 96 | $payment = Payment::findOrFail($id); |
| 97 | 97 | |
| 98 | - if (! backpack_user()->can('enrollments.edit')) { |
|
| 98 | + if (!backpack_user()->can('enrollments.edit')) { |
|
| 99 | 99 | abort(403); |
| 100 | 100 | } |
| 101 | 101 | |
| 102 | - if (! $payment->invoice) |
|
| 102 | + if (!$payment->invoice) |
|
| 103 | 103 | { |
| 104 | 104 | abort(404, 'No enrollment found for this payment'); |
| 105 | 105 | } |
@@ -75,7 +75,7 @@ |
||
| 75 | 75 | 'type' => "relationship", |
| 76 | 76 | 'name' => 'category', // the method on your model that defines the relationship |
| 77 | 77 | 'ajax' => true, |
| 78 | - 'inline_create' => [ // specify the entity in singular |
|
| 78 | + 'inline_create' => [// specify the entity in singular |
|
| 79 | 79 | 'entity' => 'gradetypecategory', // the entity in singular |
| 80 | 80 | // OPTIONALS |
| 81 | 81 | 'force_select' => true, // should the inline-created entry be immediately selected? |
@@ -56,7 +56,7 @@ |
||
| 56 | 56 | |
| 57 | 57 | CRUD::field('name')->type('text'); |
| 58 | 58 | |
| 59 | - CRUD::addfield([ |
|
| 59 | + CRUD::addfield([ |
|
| 60 | 60 | 'name' => 'presets', |
| 61 | 61 | 'label' => __('Course Schedule'), |
| 62 | 62 | 'type' => 'repeatable', |
@@ -27,7 +27,7 @@ |
||
| 27 | 27 | public function setup() |
| 28 | 28 | { |
| 29 | 29 | CRUD::setModel(\App\Models\SchedulePreset::class); |
| 30 | - CRUD::setRoute(config('backpack.base.route_prefix') . '/schedulepreset'); |
|
| 30 | + CRUD::setRoute(config('backpack.base.route_prefix').'/schedulepreset'); |
|
| 31 | 31 | CRUD::setEntityNameStrings('Schedule Preset', 'Schedule Presets'); |
| 32 | 32 | } |
| 33 | 33 | |
@@ -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([ |