@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | CRUD::setModel(Invoice::class); |
| 30 | 30 | CRUD::setRoute(config('backpack.base.route_prefix').'/invoice'); |
| 31 | 31 | CRUD::setEntityNameStrings('invoice', 'invoices'); |
| 32 | - if (! config('invoicing.price_categories_enabled')) { |
|
| 32 | + if (!config('invoicing.price_categories_enabled')) { |
|
| 33 | 33 | $this->crud->addButtonFromView('top', 'createInvoice', 'createInvoice', 'start'); |
| 34 | 34 | } |
| 35 | 35 | } |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | { |
| 95 | 95 | $invoice = Invoice::findOrFail($id)->load('payments'); |
| 96 | 96 | |
| 97 | - if (! backpack_user()->can('enrollments.edit')) { |
|
| 97 | + if (!backpack_user()->can('enrollments.edit')) { |
|
| 98 | 98 | abort(403); |
| 99 | 99 | } |
| 100 | 100 | |
@@ -72,7 +72,7 @@ |
||
| 72 | 72 | 'type' => 'relationship', |
| 73 | 73 | 'name' => 'category', // the method on your model that defines the relationship |
| 74 | 74 | 'ajax' => true, |
| 75 | - 'inline_create' => [ // specify the entity in singular |
|
| 75 | + 'inline_create' => [// specify the entity in singular |
|
| 76 | 76 | 'entity' => 'gradetypecategory', // the entity in singular |
| 77 | 77 | // OPTIONALS |
| 78 | 78 | 'force_select' => true, // should the inline-created entry be immediately selected? |
@@ -28,14 +28,14 @@ |
||
| 28 | 28 | protected function setupListOperation() |
| 29 | 29 | { |
| 30 | 30 | CRUD::addColumn(['name' => 'name', 'label' => 'Name']); |
| 31 | - CRUD::addColumn(['name' => 'lms_id', 'label' => 'LMS code', 'type' => 'text'], ); |
|
| 31 | + CRUD::addColumn(['name' => 'lms_id', 'label' => 'LMS code', 'type' => 'text'],); |
|
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | protected function setupCreateOperation() |
| 35 | 35 | { |
| 36 | 36 | CRUD::setValidation(StoreRequest::class); |
| 37 | 37 | CRUD::addField(['name' => 'name', 'label' => 'Name', 'type' => 'text']); |
| 38 | - CRUD::addField(['name' => 'lms_id', 'label' => 'LMS code', 'type' => 'text'], ); |
|
| 38 | + CRUD::addField(['name' => 'lms_id', 'label' => 'LMS code', 'type' => 'text'],); |
|
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | protected function setupUpdateOperation() |
@@ -97,7 +97,7 @@ |
||
| 97 | 97 | 'type' => 'date', |
| 98 | 98 | ]); |
| 99 | 99 | |
| 100 | - CRUD::addField([ // Checkbox |
|
| 100 | + CRUD::addField([// Checkbox |
|
| 101 | 101 | 'name' => 'auto_renewal', |
| 102 | 102 | 'label' => __('Tacit renewal'), |
| 103 | 103 | 'type' => 'checkbox', |
@@ -74,20 +74,20 @@ |
||
| 74 | 74 | ], fn () => Teacher::all()->pluck('name', 'id')->toArray(), function ($value) { // if the filter is active |
| 75 | 75 | CRUD::addClause('where', 'teacher_id', $value); |
| 76 | 76 | }, |
| 77 | - function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
| 78 | - }); |
|
| 77 | + function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
| 78 | + }); |
|
| 79 | 79 | |
| 80 | 80 | CRUD::addFilter([ // daterange filter |
| 81 | 81 | 'type' => 'date_range', |
| 82 | 82 | 'name' => 'from_to', |
| 83 | 83 | 'label'=> __('Date range'), |
| 84 | 84 | ], |
| 85 | - false, |
|
| 86 | - function ($value) { // if the filter is active, apply these constraints |
|
| 87 | - $dates = json_decode($value, null, 512, JSON_THROW_ON_ERROR); |
|
| 88 | - CRUD::addClause('where', 'date', '>=', $dates->from); |
|
| 89 | - CRUD::addClause('where', 'date', '<=', $dates->to.' 23:59:59'); |
|
| 90 | - }); |
|
| 85 | + false, |
|
| 86 | + function ($value) { // if the filter is active, apply these constraints |
|
| 87 | + $dates = json_decode($value, null, 512, JSON_THROW_ON_ERROR); |
|
| 88 | + CRUD::addClause('where', 'date', '>=', $dates->from); |
|
| 89 | + CRUD::addClause('where', 'date', '<=', $dates->to.' 23:59:59'); |
|
| 90 | + }); |
|
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | protected function setupCreateOperation() |
@@ -67,23 +67,23 @@ discard block |
||
| 67 | 67 | ], |
| 68 | 68 | ]); |
| 69 | 69 | |
| 70 | - CRUD::addFilter([ // select2 filter |
|
| 70 | + CRUD::addFilter([// select2 filter |
|
| 71 | 71 | 'name' => 'teacher_id', |
| 72 | 72 | 'type' => 'select2', |
| 73 | 73 | 'label'=> __('Teacher'), |
| 74 | - ], fn () => Teacher::all()->pluck('name', 'id')->toArray(), function ($value) { // if the filter is active |
|
| 74 | + ], fn() => Teacher::all()->pluck('name', 'id')->toArray(), function($value) { // if the filter is active |
|
| 75 | 75 | CRUD::addClause('where', 'teacher_id', $value); |
| 76 | 76 | }, |
| 77 | - function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
| 77 | + function() { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
| 78 | 78 | }); |
| 79 | 79 | |
| 80 | - CRUD::addFilter([ // daterange filter |
|
| 80 | + CRUD::addFilter([// daterange filter |
|
| 81 | 81 | 'type' => 'date_range', |
| 82 | 82 | 'name' => 'from_to', |
| 83 | 83 | 'label'=> __('Date range'), |
| 84 | 84 | ], |
| 85 | 85 | false, |
| 86 | - function ($value) { // if the filter is active, apply these constraints |
|
| 86 | + function($value) { // if the filter is active, apply these constraints |
|
| 87 | 87 | $dates = json_decode($value, null, 512, JSON_THROW_ON_ERROR); |
| 88 | 88 | CRUD::addClause('where', 'date', '>=', $dates->from); |
| 89 | 89 | CRUD::addClause('where', 'date', '<=', $dates->to.' 23:59:59'); |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | 'model' => LeaveType::class, // foreign key model |
| 116 | 116 | ], |
| 117 | 117 | |
| 118 | - [ // date_range |
|
| 118 | + [// date_range |
|
| 119 | 119 | 'name' => ['start_date', 'end_date'], // db columns for start_date & end_date |
| 120 | 120 | 'label' => 'Event Date Range', |
| 121 | 121 | 'type' => 'date_range', |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | 'model' => LeaveType::class, // foreign key model |
| 160 | 160 | ], |
| 161 | 161 | |
| 162 | - [ // datepicker |
|
| 162 | + [// datepicker |
|
| 163 | 163 | 'name' => 'date', |
| 164 | 164 | 'label' => 'Event Date', |
| 165 | 165 | 'type' => 'date', |
@@ -116,39 +116,39 @@ discard block |
||
| 116 | 116 | 'name' => 'from_to', |
| 117 | 117 | 'label'=> __('Date range'), |
| 118 | 118 | ], |
| 119 | - false, |
|
| 120 | - function ($value) { // if the filter is active, apply these constraints |
|
| 121 | - $dates = json_decode($value, null, 512, JSON_THROW_ON_ERROR); |
|
| 122 | - |
|
| 123 | - if ($dates->from) { |
|
| 124 | - CRUD::addClause('where', 'start', '>=', $dates->from); |
|
| 125 | - } |
|
| 126 | - if ($dates->to) { |
|
| 127 | - CRUD::addClause('where', 'start', '<=', $dates->to.' 23:59:59'); |
|
| 128 | - } |
|
| 129 | - }); |
|
| 119 | + false, |
|
| 120 | + function ($value) { // if the filter is active, apply these constraints |
|
| 121 | + $dates = json_decode($value, null, 512, JSON_THROW_ON_ERROR); |
|
| 122 | + |
|
| 123 | + if ($dates->from) { |
|
| 124 | + CRUD::addClause('where', 'start', '>=', $dates->from); |
|
| 125 | + } |
|
| 126 | + if ($dates->to) { |
|
| 127 | + CRUD::addClause('where', 'start', '<=', $dates->to.' 23:59:59'); |
|
| 128 | + } |
|
| 129 | + }); |
|
| 130 | 130 | |
| 131 | 131 | CRUD::addFilter([ |
| 132 | 132 | 'type' => 'simple', |
| 133 | 133 | 'name' => 'orphan', |
| 134 | 134 | 'label'=> __('Events with no course'), |
| 135 | 135 | ], |
| 136 | - false, |
|
| 137 | - function ($value) { // if the filter is active, apply these constraints |
|
| 138 | - $this->crud->query->where('course_id', null); |
|
| 139 | - }, |
|
| 140 | - function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
| 141 | - }); |
|
| 136 | + false, |
|
| 137 | + function ($value) { // if the filter is active, apply these constraints |
|
| 138 | + $this->crud->query->where('course_id', null); |
|
| 139 | + }, |
|
| 140 | + function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
| 141 | + }); |
|
| 142 | 142 | |
| 143 | 143 | CRUD::addFilter([ |
| 144 | 144 | 'type' => 'simple', |
| 145 | 145 | 'name' => 'unassigned', |
| 146 | 146 | 'label'=> __('Events with no teacher'), |
| 147 | 147 | ], |
| 148 | - false, |
|
| 149 | - function ($value) { // if the filter is active, apply these constraints |
|
| 150 | - CRUD::addClause('unassigned'); |
|
| 151 | - }); |
|
| 148 | + false, |
|
| 149 | + function ($value) { // if the filter is active, apply these constraints |
|
| 150 | + CRUD::addClause('unassigned'); |
|
| 151 | + }); |
|
| 152 | 152 | |
| 153 | 153 | CRUD::addFilter([ // select2 filter |
| 154 | 154 | 'name' => 'teacher_id', |
@@ -157,8 +157,8 @@ discard block |
||
| 157 | 157 | ], fn () => Teacher::all()->pluck('name', 'id')->toArray(), function ($value) { // if the filter is active |
| 158 | 158 | CRUD::addClause('where', 'teacher_id', $value); |
| 159 | 159 | }, |
| 160 | - function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
| 161 | - }); |
|
| 160 | + function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
| 161 | + }); |
|
| 162 | 162 | } |
| 163 | 163 | |
| 164 | 164 | public function store(Request $request) |
@@ -111,13 +111,13 @@ discard block |
||
| 111 | 111 | |
| 112 | 112 | ]); |
| 113 | 113 | |
| 114 | - CRUD::addFilter([ // daterange filter |
|
| 114 | + CRUD::addFilter([// daterange filter |
|
| 115 | 115 | 'type' => 'date_range', |
| 116 | 116 | 'name' => 'from_to', |
| 117 | 117 | 'label'=> __('Date range'), |
| 118 | 118 | ], |
| 119 | 119 | false, |
| 120 | - function ($value) { // if the filter is active, apply these constraints |
|
| 120 | + function($value) { // if the filter is active, apply these constraints |
|
| 121 | 121 | $dates = json_decode($value, null, 512, JSON_THROW_ON_ERROR); |
| 122 | 122 | |
| 123 | 123 | if ($dates->from) { |
@@ -134,10 +134,10 @@ discard block |
||
| 134 | 134 | 'label'=> __('Events with no course'), |
| 135 | 135 | ], |
| 136 | 136 | false, |
| 137 | - function ($value) { // if the filter is active, apply these constraints |
|
| 137 | + function($value) { // if the filter is active, apply these constraints |
|
| 138 | 138 | $this->crud->query->where('course_id', null); |
| 139 | 139 | }, |
| 140 | - function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
| 140 | + function() { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
| 141 | 141 | }); |
| 142 | 142 | |
| 143 | 143 | CRUD::addFilter([ |
@@ -146,18 +146,18 @@ discard block |
||
| 146 | 146 | 'label'=> __('Events with no teacher'), |
| 147 | 147 | ], |
| 148 | 148 | false, |
| 149 | - function ($value) { // if the filter is active, apply these constraints |
|
| 149 | + function($value) { // if the filter is active, apply these constraints |
|
| 150 | 150 | CRUD::addClause('unassigned'); |
| 151 | 151 | }); |
| 152 | 152 | |
| 153 | - CRUD::addFilter([ // select2 filter |
|
| 153 | + CRUD::addFilter([// select2 filter |
|
| 154 | 154 | 'name' => 'teacher_id', |
| 155 | 155 | 'type' => 'select2', |
| 156 | 156 | 'label'=> __('Teacher'), |
| 157 | - ], fn () => Teacher::all()->pluck('name', 'id')->toArray(), function ($value) { // if the filter is active |
|
| 157 | + ], fn() => Teacher::all()->pluck('name', 'id')->toArray(), function($value) { // if the filter is active |
|
| 158 | 158 | CRUD::addClause('where', 'teacher_id', $value); |
| 159 | 159 | }, |
| 160 | - function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
| 160 | + function() { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
| 161 | 161 | }); |
| 162 | 162 | } |
| 163 | 163 | |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | $q->where('firstname', 'like', '%'.$searchTerm.'%') |
| 59 | 59 | ->orWhere('lastname', 'like', '%'.$searchTerm.'%') |
| 60 | 60 | ->orWhere('email', 'like', '%'.$searchTerm.'%') |
| 61 | - ->orWhere('idnumber', 'like', '%'.$searchTerm.'%'); |
|
| 61 | + ->orWhere('idnumber', 'like', '%'.$searchTerm.'%'); |
|
| 62 | 62 | }); |
| 63 | 63 | }); |
| 64 | 64 | }, |
@@ -92,10 +92,10 @@ discard block |
||
| 92 | 92 | 'name' => 'noresult', |
| 93 | 93 | 'label'=> __('No Result'), |
| 94 | 94 | ], |
| 95 | - false, |
|
| 96 | - function () { |
|
| 97 | - CRUD::addClause('noResult'); |
|
| 98 | - } |
|
| 95 | + false, |
|
| 96 | + function () { |
|
| 97 | + CRUD::addClause('noResult'); |
|
| 98 | + } |
|
| 99 | 99 | ); |
| 100 | 100 | |
| 101 | 101 | CRUD::addFilter( |
@@ -52,9 +52,9 @@ discard block |
||
| 52 | 52 | 'type' => 'select', |
| 53 | 53 | 'name' => 'student', // the method that defines the relationship in your Model |
| 54 | 54 | 'attribute' => 'name', // foreign key attribute that is shown to user |
| 55 | - 'searchLogic' => function ($query, $column, $searchTerm) { |
|
| 56 | - $query->orWhereHas('student', function ($q) use ($searchTerm) { |
|
| 57 | - $q->WhereHas('user', function ($q) use ($searchTerm) { |
|
| 55 | + 'searchLogic' => function($query, $column, $searchTerm) { |
|
| 56 | + $query->orWhereHas('student', function($q) use ($searchTerm) { |
|
| 57 | + $q->WhereHas('user', function($q) use ($searchTerm) { |
|
| 58 | 58 | $q->where('firstname', 'like', '%'.$searchTerm.'%') |
| 59 | 59 | ->orWhere('lastname', 'like', '%'.$searchTerm.'%') |
| 60 | 60 | ->orWhere('email', 'like', '%'.$searchTerm.'%') |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | 'label'=> __('No Result'), |
| 94 | 94 | ], |
| 95 | 95 | false, |
| 96 | - function () { |
|
| 96 | + function() { |
|
| 97 | 97 | CRUD::addClause('noResult'); |
| 98 | 98 | } |
| 99 | 99 | ); |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | 'label'=> __('Hide Parents'), |
| 106 | 106 | ], |
| 107 | 107 | false, |
| 108 | - function () { |
|
| 108 | + function() { |
|
| 109 | 109 | CRUD::addClause('real'); |
| 110 | 110 | } |
| 111 | 111 | ); |
@@ -114,16 +114,16 @@ discard block |
||
| 114 | 114 | 'name' => 'period_id', |
| 115 | 115 | 'type' => 'select2', |
| 116 | 116 | 'label'=> __('Period'), |
| 117 | - ], fn () => Period::all()->pluck('name', 'id')->toArray(), function ($value) { // if the filter is active |
|
| 117 | + ], fn() => Period::all()->pluck('name', 'id')->toArray(), function($value) { // if the filter is active |
|
| 118 | 118 | CRUD::addClause('period', $value); |
| 119 | 119 | }); |
| 120 | 120 | |
| 121 | - CRUD::addFilter([ // select2_multiple filter |
|
| 121 | + CRUD::addFilter([// select2_multiple filter |
|
| 122 | 122 | 'name' => 'result', |
| 123 | 123 | 'type' => 'select2', |
| 124 | 124 | 'label'=> __('Result'), |
| 125 | - ], fn () => ResultType::all()->pluck('name', 'id')->toArray(), function ($value) { // if the filter is active |
|
| 126 | - $this->crud->query = $this->crud->query->whereHas('result', function ($query) use ($value) { |
|
| 125 | + ], fn() => ResultType::all()->pluck('name', 'id')->toArray(), function($value) { // if the filter is active |
|
| 126 | + $this->crud->query = $this->crud->query->whereHas('result', function($query) use ($value) { |
|
| 127 | 127 | $query->where('result_type_id', $value); |
| 128 | 128 | }); |
| 129 | 129 | }); |
@@ -184,8 +184,8 @@ |
||
| 184 | 184 | $q->where('period_id', $value); |
| 185 | 185 | })); |
| 186 | 186 | }, |
| 187 | - function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
| 188 | - }); |
|
| 187 | + function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
| 188 | + }); |
|
| 189 | 189 | |
| 190 | 190 | CRUD::addFilter([ // select2_multiple filter |
| 191 | 191 | 'name' => 'notenrolled', |
@@ -91,10 +91,10 @@ discard block |
||
| 91 | 91 | 'attribute' => 'lastname', // foreign key attribute that is shown to user |
| 92 | 92 | 'model' => \App\Models\User::class, // foreign key model |
| 93 | 93 | 'orderable' => true, |
| 94 | - 'orderLogic' => fn ($query, $column, $columnDirection) => $query->leftJoin('users', 'users.id', '=', 'students.id') |
|
| 94 | + 'orderLogic' => fn($query, $column, $columnDirection) => $query->leftJoin('users', 'users.id', '=', 'students.id') |
|
| 95 | 95 | ->orderBy('users.lastname', $columnDirection)->select('students.*'), |
| 96 | - 'searchLogic' => function ($query, $column, $searchTerm) { |
|
| 97 | - $query->orWhereHas('user', function ($q) use ($searchTerm) { |
|
| 96 | + 'searchLogic' => function($query, $column, $searchTerm) { |
|
| 97 | + $query->orWhereHas('user', function($q) use ($searchTerm) { |
|
| 98 | 98 | $q->where('lastname', 'like', '%'.$searchTerm.'%'); |
| 99 | 99 | }); |
| 100 | 100 | }, |
@@ -109,10 +109,10 @@ discard block |
||
| 109 | 109 | 'attribute' => 'firstname', // foreign key attribute that is shown to user |
| 110 | 110 | 'model' => \App\Models\User::class, // foreign key model |
| 111 | 111 | 'orderable' => true, |
| 112 | - 'orderLogic' => fn ($query, $column, $columnDirection) => $query->leftJoin('users', 'users.id', '=', 'students.id') |
|
| 112 | + 'orderLogic' => fn($query, $column, $columnDirection) => $query->leftJoin('users', 'users.id', '=', 'students.id') |
|
| 113 | 113 | ->orderBy('users.firstname', $columnDirection)->select('students.*'), |
| 114 | - 'searchLogic' => function ($query, $column, $searchTerm) { |
|
| 115 | - $query->orWhereHas('user', function ($q) use ($searchTerm) { |
|
| 114 | + 'searchLogic' => function($query, $column, $searchTerm) { |
|
| 115 | + $query->orWhereHas('user', function($q) use ($searchTerm) { |
|
| 116 | 116 | $q->where('firstname', 'like', '%'.$searchTerm.'%'); |
| 117 | 117 | }); |
| 118 | 118 | }, |
@@ -126,10 +126,10 @@ discard block |
||
| 126 | 126 | 'attribute' => 'email', // foreign key attribute that is shown to user |
| 127 | 127 | 'model' => \App\Models\User::class, // foreign key model |
| 128 | 128 | 'orderable' => true, |
| 129 | - 'orderLogic' => fn ($query, $column, $columnDirection) => $query->leftJoin('users', 'users.id', '=', 'students.id') |
|
| 129 | + 'orderLogic' => fn($query, $column, $columnDirection) => $query->leftJoin('users', 'users.id', '=', 'students.id') |
|
| 130 | 130 | ->orderBy('users.email', $columnDirection)->select('students.*'), |
| 131 | - 'searchLogic' => function ($query, $column, $searchTerm) { |
|
| 132 | - $query->orWhereHas('user', function ($q) use ($searchTerm) { |
|
| 131 | + 'searchLogic' => function($query, $column, $searchTerm) { |
|
| 132 | + $query->orWhereHas('user', function($q) use ($searchTerm) { |
|
| 133 | 133 | $q->where('email', 'like', '%'.$searchTerm.'%'); |
| 134 | 134 | }); |
| 135 | 135 | }, |
@@ -175,25 +175,25 @@ discard block |
||
| 175 | 175 | |
| 176 | 176 | ]); |
| 177 | 177 | |
| 178 | - CRUD::addFilter([ // select2 filter |
|
| 178 | + CRUD::addFilter([// select2 filter |
|
| 179 | 179 | 'name' => 'enrolled', |
| 180 | 180 | 'type' => 'select2', |
| 181 | 181 | 'label'=> __('Is Enrolled in'), |
| 182 | - ], fn () => Period::all()->pluck('name', 'id')->toArray(), function ($value) { // if the filter is active |
|
| 183 | - $this->crud->query = $this->crud->query->whereHas('enrollments', fn ($query) => $query->whereHas('course', function ($q) use ($value) { |
|
| 182 | + ], fn() => Period::all()->pluck('name', 'id')->toArray(), function($value) { // if the filter is active |
|
| 183 | + $this->crud->query = $this->crud->query->whereHas('enrollments', fn($query) => $query->whereHas('course', function($q) use ($value) { |
|
| 184 | 184 | $q->where('period_id', $value); |
| 185 | 185 | })); |
| 186 | 186 | }, |
| 187 | - function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
| 187 | + function() { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
| 188 | 188 | }); |
| 189 | 189 | |
| 190 | - CRUD::addFilter([ // select2_multiple filter |
|
| 190 | + CRUD::addFilter([// select2_multiple filter |
|
| 191 | 191 | 'name' => 'notenrolled', |
| 192 | 192 | 'type' => 'select2_multiple', |
| 193 | 193 | 'label'=> __('Is Not Enrolled in'), |
| 194 | - ], fn () => Period::all()->pluck('name', 'id')->toArray(), function ($values) { // if the filter is active |
|
| 194 | + ], fn() => Period::all()->pluck('name', 'id')->toArray(), function($values) { // if the filter is active |
|
| 195 | 195 | foreach (json_decode($values, null, 512, JSON_THROW_ON_ERROR) as $value) { |
| 196 | - $this->crud->query = $this->crud->query->whereDoesntHave('enrollments', fn ($query) => $query->whereHas('course', function ($q) use ($value) { |
|
| 196 | + $this->crud->query = $this->crud->query->whereDoesntHave('enrollments', fn($query) => $query->whereHas('course', function($q) use ($value) { |
|
| 197 | 197 | $q->where('period_id', $value); |
| 198 | 198 | })); |
| 199 | 199 | } |
@@ -204,8 +204,8 @@ discard block |
||
| 204 | 204 | 'type' => 'select2', |
| 205 | 205 | 'label'=> __('New In'), |
| 206 | 206 | ], |
| 207 | - fn () => Period::all()->pluck('name', 'id')->toArray(), |
|
| 208 | - function ($value) { // if the filter is active |
|
| 207 | + fn() => Period::all()->pluck('name', 'id')->toArray(), |
|
| 208 | + function($value) { // if the filter is active |
|
| 209 | 209 | CRUD::addClause('newInPeriod', $value); |
| 210 | 210 | } |
| 211 | 211 | ); |
@@ -215,7 +215,7 @@ discard block |
||
| 215 | 215 | 'name' => 'institution_id', |
| 216 | 216 | 'type' => 'select2', |
| 217 | 217 | 'label' => __('Institution'), |
| 218 | - ], fn () => Institution::all()->pluck('name', 'id')->toArray(), function ($value) { // if the filter is active |
|
| 218 | + ], fn() => Institution::all()->pluck('name', 'id')->toArray(), function($value) { // if the filter is active |
|
| 219 | 219 | $this->crud->addClause('where', 'institution_id', $value); |
| 220 | 220 | }); |
| 221 | 221 | |
@@ -223,7 +223,7 @@ discard block |
||
| 223 | 223 | 'name' => 'status_type_id', |
| 224 | 224 | 'type' => 'select2', |
| 225 | 225 | 'label' => __('Lead Status'), |
| 226 | - ], fn () => LeadType::all()->pluck('name', 'id')->toArray(), function ($value) { |
|
| 226 | + ], fn() => LeadType::all()->pluck('name', 'id')->toArray(), function($value) { |
|
| 227 | 227 | if ($value === '4') { |
| 228 | 228 | $this->crud->query = $this->crud->query->where('lead_type_id', $value)->orWhere('lead_type_id', null); |
| 229 | 229 | } else { |
@@ -318,8 +318,8 @@ discard block |
||
| 318 | 318 | $username_parts = array_filter(explode(' ', strtolower($fullName))); |
| 319 | 319 | $username_parts = array_slice($username_parts, -2); |
| 320 | 320 | |
| 321 | - $part1 = (! empty($username_parts[0])) ? substr($username_parts[0], 0, 3) : ''; |
|
| 322 | - $part2 = (! empty($username_parts[1])) ? substr($username_parts[1], 0, 8) : ''; |
|
| 321 | + $part1 = (!empty($username_parts[0])) ? substr($username_parts[0], 0, 3) : ''; |
|
| 322 | + $part2 = (!empty($username_parts[1])) ? substr($username_parts[1], 0, 8) : ''; |
|
| 323 | 323 | $part3 = random_int(999, 9999); |
| 324 | 324 | |
| 325 | 325 | $username = $part1.$part2.$part3; //str_shuffle to randomly shuffle all characters |
@@ -407,7 +407,7 @@ discard block |
||
| 407 | 407 | { |
| 408 | 408 | $student = Student::findOrFail($student); |
| 409 | 409 | |
| 410 | - if (! backpack_user()->isTeacher() && ! backpack_user()->can('enrollments.view')) { |
|
| 410 | + if (!backpack_user()->isTeacher() && !backpack_user()->can('enrollments.view')) { |
|
| 411 | 411 | abort(403); |
| 412 | 412 | } |
| 413 | 413 | |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | 'label' => __('Due Date'), |
| 50 | 50 | ], |
| 51 | 51 | false, |
| 52 | - function ($value) { // if the filter is active, apply these constraints |
|
| 52 | + function($value) { // if the filter is active, apply these constraints |
|
| 53 | 53 | $this->crud->addClause('where', 'date', '>=', Carbon::parse($value)->firstOfMonth()); |
| 54 | 54 | $this->crud->addClause('where', 'date', '<=', Carbon::parse($value)->lastOfMonth()); |
| 55 | 55 | }); |
@@ -90,11 +90,11 @@ discard block |
||
| 90 | 90 | { |
| 91 | 91 | $payment = Payment::findOrFail($id); |
| 92 | 92 | |
| 93 | - if (! backpack_user()->can('enrollments.edit')) { |
|
| 93 | + if (!backpack_user()->can('enrollments.edit')) { |
|
| 94 | 94 | abort(403); |
| 95 | 95 | } |
| 96 | 96 | |
| 97 | - if (! $payment->invoice) { |
|
| 97 | + if (!$payment->invoice) { |
|
| 98 | 98 | abort(404, 'No enrollment found for this payment'); |
| 99 | 99 | } |
| 100 | 100 | |