@@ -75,20 +75,20 @@ |
||
| 75 | 75 | }, function ($value) { // if the filter is active |
| 76 | 76 | CRUD::addClause('where', 'teacher_id', $value); |
| 77 | 77 | }, |
| 78 | - function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
| 79 | - }); |
|
| 78 | + function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
| 79 | + }); |
|
| 80 | 80 | |
| 81 | 81 | CRUD::addFilter([ // daterange filter |
| 82 | 82 | 'type' => 'date_range', |
| 83 | 83 | 'name' => 'from_to', |
| 84 | 84 | 'label'=> __('Date range'), |
| 85 | 85 | ], |
| 86 | - false, |
|
| 87 | - function ($value) { // if the filter is active, apply these constraints |
|
| 88 | - $dates = json_decode($value); |
|
| 89 | - CRUD::addClause('where', 'date', '>=', $dates->from); |
|
| 90 | - CRUD::addClause('where', 'date', '<=', $dates->to.' 23:59:59'); |
|
| 91 | - }); |
|
| 86 | + false, |
|
| 87 | + function ($value) { // if the filter is active, apply these constraints |
|
| 88 | + $dates = json_decode($value); |
|
| 89 | + CRUD::addClause('where', 'date', '>=', $dates->from); |
|
| 90 | + CRUD::addClause('where', 'date', '<=', $dates->to.' 23:59:59'); |
|
| 91 | + }); |
|
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | protected function setupCreateOperation() |
@@ -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', |
@@ -110,39 +110,39 @@ discard block |
||
| 110 | 110 | 'name' => 'from_to', |
| 111 | 111 | 'label'=> __('Date range'), |
| 112 | 112 | ], |
| 113 | - false, |
|
| 114 | - function ($value) { // if the filter is active, apply these constraints |
|
| 115 | - $dates = json_decode($value); |
|
| 116 | - |
|
| 117 | - if ($dates->from) { |
|
| 118 | - CRUD::addClause('where', 'start', '>=', $dates->from); |
|
| 119 | - } |
|
| 120 | - if ($dates->to) { |
|
| 121 | - CRUD::addClause('where', 'start', '<=', $dates->to.' 23:59:59'); |
|
| 122 | - } |
|
| 123 | - }); |
|
| 113 | + false, |
|
| 114 | + function ($value) { // if the filter is active, apply these constraints |
|
| 115 | + $dates = json_decode($value); |
|
| 116 | + |
|
| 117 | + if ($dates->from) { |
|
| 118 | + CRUD::addClause('where', 'start', '>=', $dates->from); |
|
| 119 | + } |
|
| 120 | + if ($dates->to) { |
|
| 121 | + CRUD::addClause('where', 'start', '<=', $dates->to.' 23:59:59'); |
|
| 122 | + } |
|
| 123 | + }); |
|
| 124 | 124 | |
| 125 | 125 | CRUD::addFilter([ |
| 126 | 126 | 'type' => 'simple', |
| 127 | 127 | 'name' => 'orphan', |
| 128 | 128 | 'label'=> __('Events with no course'), |
| 129 | 129 | ], |
| 130 | - false, |
|
| 131 | - function ($value) { // if the filter is active, apply these constraints |
|
| 132 | - $this->crud->query->where('course_id', null); |
|
| 133 | - }, |
|
| 134 | - function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
| 135 | - }); |
|
| 130 | + false, |
|
| 131 | + function ($value) { // if the filter is active, apply these constraints |
|
| 132 | + $this->crud->query->where('course_id', null); |
|
| 133 | + }, |
|
| 134 | + function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
| 135 | + }); |
|
| 136 | 136 | |
| 137 | 137 | CRUD::addFilter([ |
| 138 | 138 | 'type' => 'simple', |
| 139 | 139 | 'name' => 'unassigned', |
| 140 | 140 | 'label'=> __('Events with no teacher'), |
| 141 | 141 | ], |
| 142 | - false, |
|
| 143 | - function ($value) { // if the filter is active, apply these constraints |
|
| 144 | - $this->crud->query->where('teacher_id', null); |
|
| 145 | - }); |
|
| 142 | + false, |
|
| 143 | + function ($value) { // if the filter is active, apply these constraints |
|
| 144 | + $this->crud->query->where('teacher_id', null); |
|
| 145 | + }); |
|
| 146 | 146 | |
| 147 | 147 | CRUD::addFilter([ // select2 filter |
| 148 | 148 | 'name' => 'teacher_id', |
@@ -153,8 +153,8 @@ discard block |
||
| 153 | 153 | }, function ($value) { // if the filter is active |
| 154 | 154 | CRUD::addClause('where', 'teacher_id', $value); |
| 155 | 155 | }, |
| 156 | - function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
| 157 | - }); |
|
| 156 | + function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
| 157 | + }); |
|
| 158 | 158 | } |
| 159 | 159 | |
| 160 | 160 | public function store(Request $request) |
@@ -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 | |
@@ -136,11 +136,11 @@ |
||
| 136 | 136 | ], function () { |
| 137 | 137 | return EnrollmentStatusType::all()->pluck('name', 'id')->toArray(); |
| 138 | 138 | }, |
| 139 | - function ($values) { // if the filter is active |
|
| 140 | - foreach (json_decode($values) as $key => $value) { |
|
| 141 | - CRUD::addClause('orWhere', 'status_id', $value); |
|
| 142 | - } |
|
| 143 | - }); |
|
| 139 | + function ($values) { // if the filter is active |
|
| 140 | + foreach (json_decode($values) as $key => $value) { |
|
| 141 | + CRUD::addClause('orWhere', 'status_id', $value); |
|
| 142 | + } |
|
| 143 | + }); |
|
| 144 | 144 | |
| 145 | 145 | CRUD::addFilter([ |
| 146 | 146 | 'name' => 'period_id', |
@@ -69,9 +69,9 @@ discard block |
||
| 69 | 69 | 'name' => 'user.lastname', |
| 70 | 70 | 'label' => __('Last Name'), |
| 71 | 71 | 'type' => 'text', |
| 72 | - 'searchLogic' => function ($query, $column, $searchTerm) { |
|
| 73 | - $query->orWhereHas('student', function ($q) use ($searchTerm) { |
|
| 74 | - $q->whereHas('user', function ($q) use ($searchTerm) { |
|
| 72 | + 'searchLogic' => function($query, $column, $searchTerm) { |
|
| 73 | + $query->orWhereHas('student', function($q) use ($searchTerm) { |
|
| 74 | + $q->whereHas('user', function($q) use ($searchTerm) { |
|
| 75 | 75 | $q->where('lastname', 'like', '%'.$searchTerm.'%'); |
| 76 | 76 | }); |
| 77 | 77 | }); |
@@ -82,9 +82,9 @@ discard block |
||
| 82 | 82 | 'name' => 'user.firstname', |
| 83 | 83 | 'label' => __('First Name'), |
| 84 | 84 | 'type' => 'text', |
| 85 | - 'searchLogic' => function ($query, $column, $searchTerm) { |
|
| 86 | - $query->orWhereHas('student', function ($q) use ($searchTerm) { |
|
| 87 | - $q->whereHas('user', function ($q) use ($searchTerm) { |
|
| 85 | + 'searchLogic' => function($query, $column, $searchTerm) { |
|
| 86 | + $query->orWhereHas('student', function($q) use ($searchTerm) { |
|
| 87 | + $q->whereHas('user', function($q) use ($searchTerm) { |
|
| 88 | 88 | $q->where('firstname', 'like', '%'.$searchTerm.'%'); |
| 89 | 89 | }); |
| 90 | 90 | }); |
@@ -133,10 +133,10 @@ discard block |
||
| 133 | 133 | 'name' => 'status_id', |
| 134 | 134 | 'type' => 'select2_multiple', |
| 135 | 135 | 'label'=> __('Status'), |
| 136 | - ], function () { |
|
| 136 | + ], function() { |
|
| 137 | 137 | return EnrollmentStatusType::all()->pluck('name', 'id')->toArray(); |
| 138 | 138 | }, |
| 139 | - function ($values) { // if the filter is active |
|
| 139 | + function($values) { // if the filter is active |
|
| 140 | 140 | foreach (json_decode($values) as $key => $value) { |
| 141 | 141 | CRUD::addClause('orWhere', 'status_id', $value); |
| 142 | 142 | } |
@@ -146,9 +146,9 @@ discard block |
||
| 146 | 146 | 'name' => 'period_id', |
| 147 | 147 | 'type' => 'select2', |
| 148 | 148 | 'label'=> __('Period'), |
| 149 | - ], function () { |
|
| 149 | + ], function() { |
|
| 150 | 150 | return Period::all()->pluck('name', 'id')->toArray(); |
| 151 | - }, function ($value) { // if the filter is active |
|
| 151 | + }, function($value) { // if the filter is active |
|
| 152 | 152 | CRUD::addClause('period', $value); |
| 153 | 153 | }); |
| 154 | 154 | } |
@@ -52,8 +52,8 @@ discard block |
||
| 52 | 52 | protected function mapWebRoutes() |
| 53 | 53 | { |
| 54 | 54 | Route::middleware('web') |
| 55 | - ->namespace($this->namespace) |
|
| 56 | - ->group(base_path('routes/web.php')); |
|
| 55 | + ->namespace($this->namespace) |
|
| 56 | + ->group(base_path('routes/web.php')); |
|
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | /** |
@@ -66,8 +66,8 @@ discard block |
||
| 66 | 66 | protected function mapApiRoutes() |
| 67 | 67 | { |
| 68 | 68 | Route::prefix('api') |
| 69 | - ->middleware('api') |
|
| 70 | - ->namespace($this->namespace) |
|
| 71 | - ->group(base_path('routes/api.php')); |
|
| 69 | + ->middleware('api') |
|
| 70 | + ->namespace($this->namespace) |
|
| 71 | + ->group(base_path('routes/api.php')); |
|
| 72 | 72 | } |
| 73 | 73 | } |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | |
| 21 | 21 | $this->hideSensitiveRequestDetails(); |
| 22 | 22 | |
| 23 | - Telescope::filter(function (IncomingEntry $entry) { |
|
| 23 | + Telescope::filter(function(IncomingEntry $entry) { |
|
| 24 | 24 | if ($this->app->isLocal()) { |
| 25 | 25 | return true; |
| 26 | 26 | } |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | */ |
| 62 | 62 | protected function gate() |
| 63 | 63 | { |
| 64 | - Gate::define('viewTelescope', function ($user) { |
|
| 64 | + Gate::define('viewTelescope', function($user) { |
|
| 65 | 65 | return in_array($user->email, [ |
| 66 | 66 | // |
| 67 | 67 | ]); |
@@ -37,7 +37,7 @@ |
||
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | View::composer( |
| 40 | - ['partials.create_new_contact', 'students.edit-contact'], function ($view) { |
|
| 40 | + ['partials.create_new_contact', 'students.edit-contact'], function($view) { |
|
| 41 | 41 | $view->with('contact_types', ContactRelationship::all()); |
| 42 | 42 | }); |
| 43 | 43 | } |
@@ -54,7 +54,8 @@ discard block |
||
| 54 | 54 | |
| 55 | 55 | public function search() |
| 56 | 56 | { |
| 57 | - return QueryBuilder::for(Course::class)->where('campus_id', 1) |
|
| 57 | + return QueryBuilder::for(Course::class) { |
|
| 58 | + ->where('campus_id', 1) |
|
| 58 | 59 | ->with('room')->withCount('events')->withCount('children')->withCount('enrollments') |
| 59 | 60 | ->allowedFilters([ |
| 60 | 61 | 'name', |
@@ -63,5 +64,6 @@ discard block |
||
| 63 | 64 | AllowedFilter::custom('searchable_levels', new FiltersSearchableLevels()), |
| 64 | 65 | 'teacher_id', ]) |
| 65 | 66 | ->get(); |
| 67 | + } |
|
| 66 | 68 | } |
| 67 | 69 | } |
@@ -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', |
@@ -92,10 +92,10 @@ discard block |
||
| 92 | 92 | 'name' => 'action', |
| 93 | 93 | 'label'=> 'Action', |
| 94 | 94 | ], |
| 95 | - false, |
|
| 96 | - function () { // if the filter is active |
|
| 97 | - CRUD::addClause('where', 'action', true); |
|
| 98 | - }); |
|
| 95 | + false, |
|
| 96 | + function () { // if the filter is active |
|
| 97 | + CRUD::addClause('where', 'action', true); |
|
| 98 | + }); |
|
| 99 | 99 | |
| 100 | 100 | CRUD::addFilter([ // dropdown filter |
| 101 | 101 | 'name' => 'type', |
@@ -109,10 +109,10 @@ discard block |
||
| 109 | 109 | ], function ($value) { // if the filter is active |
| 110 | 110 | CRUD::addClause('where', 'commentable_type', '=', $value); |
| 111 | 111 | }, |
| 112 | - function () { // if the filter is not active |
|
| 113 | - CRUD::addClause('where', 'commentable_type', '=', Student::class); |
|
| 114 | - $this->crud->getRequest()->request->add(['commentable_type' => Student::class]); // to make the filter look active |
|
| 115 | - }); |
|
| 112 | + function () { // if the filter is not active |
|
| 113 | + CRUD::addClause('where', 'commentable_type', '=', Student::class); |
|
| 114 | + $this->crud->getRequest()->request->add(['commentable_type' => Student::class]); // to make the filter look active |
|
| 115 | + }); |
|
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | public function setupUpdateOperation() |
@@ -87,17 +87,17 @@ discard block |
||
| 87 | 87 | ], |
| 88 | 88 | ]); |
| 89 | 89 | |
| 90 | - CRUD::addFilter([ // simple filter |
|
| 90 | + CRUD::addFilter([// simple filter |
|
| 91 | 91 | 'type' => 'simple', |
| 92 | 92 | 'name' => 'action', |
| 93 | 93 | 'label'=> 'Action', |
| 94 | 94 | ], |
| 95 | 95 | false, |
| 96 | - function () { // if the filter is active |
|
| 96 | + function() { // if the filter is active |
|
| 97 | 97 | CRUD::addClause('where', 'action', true); |
| 98 | 98 | }); |
| 99 | 99 | |
| 100 | - CRUD::addFilter([ // dropdown filter |
|
| 100 | + CRUD::addFilter([// dropdown filter |
|
| 101 | 101 | 'name' => 'type', |
| 102 | 102 | 'type' => 'dropdown', |
| 103 | 103 | 'label'=> 'Type', |
@@ -106,10 +106,10 @@ discard block |
||
| 106 | 106 | Enrollment::class => 'Enrollments', |
| 107 | 107 | Result::class => 'Result', |
| 108 | 108 | |
| 109 | - ], function ($value) { // if the filter is active |
|
| 109 | + ], function($value) { // if the filter is active |
|
| 110 | 110 | CRUD::addClause('where', 'commentable_type', '=', $value); |
| 111 | 111 | }, |
| 112 | - function () { // if the filter is not active |
|
| 112 | + function() { // if the filter is not active |
|
| 113 | 113 | CRUD::addClause('where', 'commentable_type', '=', Student::class); |
| 114 | 114 | $this->crud->getRequest()->request->add(['commentable_type' => Student::class]); // to make the filter look active |
| 115 | 115 | }); |
@@ -181,8 +181,8 @@ discard block |
||
| 181 | 181 | }, function ($value) { // if the filter is active |
| 182 | 182 | CRUD::addClause('where', 'rhythm_id', $value); |
| 183 | 183 | }, |
| 184 | - function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
| 185 | - }); |
|
| 184 | + function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
| 185 | + }); |
|
| 186 | 186 | |
| 187 | 187 | CRUD::addFilter([ // select2 filter |
| 188 | 188 | 'name' => 'teacher_id', |
@@ -193,8 +193,8 @@ discard block |
||
| 193 | 193 | }, function ($value) { // if the filter is active |
| 194 | 194 | CRUD::addClause('where', 'teacher_id', $value); |
| 195 | 195 | }, |
| 196 | - function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
| 197 | - }); |
|
| 196 | + function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
| 197 | + }); |
|
| 198 | 198 | |
| 199 | 199 | CRUD::addFilter([ // select2 filter |
| 200 | 200 | 'name' => 'level_id', |
@@ -205,8 +205,8 @@ discard block |
||
| 205 | 205 | }, function ($value) { // if the filter is active |
| 206 | 206 | CRUD::addClause('where', 'level_id', $value); |
| 207 | 207 | }, |
| 208 | - function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
| 209 | - }); |
|
| 208 | + function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
| 209 | + }); |
|
| 210 | 210 | |
| 211 | 211 | CRUD::addFilter([ // select2 filter |
| 212 | 212 | 'name' => 'period_id', |
@@ -217,11 +217,11 @@ discard block |
||
| 217 | 217 | }, function ($value) { // if the filter is active |
| 218 | 218 | CRUD::addClause('where', 'period_id', $value); |
| 219 | 219 | }, |
| 220 | - function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
| 221 | - $period = Period::get_default_period()->id; |
|
| 222 | - CRUD::addClause('where', 'period_id', $period); |
|
| 223 | - $this->crud->getRequest()->request->add(['period_id' => $period]); // to make the filter look active |
|
| 224 | - }); |
|
| 220 | + function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
| 221 | + $period = Period::get_default_period()->id; |
|
| 222 | + CRUD::addClause('where', 'period_id', $period); |
|
| 223 | + $this->crud->getRequest()->request->add(['period_id' => $period]); // to make the filter look active |
|
| 224 | + }); |
|
| 225 | 225 | } |
| 226 | 226 | |
| 227 | 227 | protected function setupCreateOperation() |
@@ -57,11 +57,11 @@ discard block |
||
| 57 | 57 | |
| 58 | 58 | $permissions = backpack_user()->getAllPermissions(); |
| 59 | 59 | |
| 60 | - if (! $permissions->contains('name', 'courses.edit')) { |
|
| 60 | + if (!$permissions->contains('name', 'courses.edit')) { |
|
| 61 | 61 | CRUD::denyAccess('update'); |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | - if (! $permissions->contains('name', 'courses.edit')) { |
|
| 64 | + if (!$permissions->contains('name', 'courses.edit')) { |
|
| 65 | 65 | CRUD::denyAccess('create'); |
| 66 | 66 | } |
| 67 | 67 | |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | |
| 76 | 76 | CRUD::addButtonFromView('line', 'children_badge', 'children_badge', 'beginning'); |
| 77 | 77 | |
| 78 | - if (! $permissions->contains('name', 'courses.delete')) { |
|
| 78 | + if (!$permissions->contains('name', 'courses.delete')) { |
|
| 79 | 79 | CRUD::denyAccess('delete'); |
| 80 | 80 | } |
| 81 | 81 | |
@@ -172,52 +172,52 @@ discard block |
||
| 172 | 172 | |
| 173 | 173 | ]); |
| 174 | 174 | |
| 175 | - CRUD::addFilter([ // select2 filter |
|
| 175 | + CRUD::addFilter([// select2 filter |
|
| 176 | 176 | 'name' => 'rhythm_id', |
| 177 | 177 | 'type' => 'select2', |
| 178 | 178 | 'label'=> __('Rhythm'), |
| 179 | - ], function () { |
|
| 179 | + ], function() { |
|
| 180 | 180 | return Rhythm::all()->pluck('name', 'id')->toArray(); |
| 181 | - }, function ($value) { // if the filter is active |
|
| 181 | + }, function($value) { // if the filter is active |
|
| 182 | 182 | CRUD::addClause('where', 'rhythm_id', $value); |
| 183 | 183 | }, |
| 184 | - function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
| 184 | + function() { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
| 185 | 185 | }); |
| 186 | 186 | |
| 187 | - CRUD::addFilter([ // select2 filter |
|
| 187 | + CRUD::addFilter([// select2 filter |
|
| 188 | 188 | 'name' => 'teacher_id', |
| 189 | 189 | 'type' => 'select2', |
| 190 | 190 | 'label'=> __('Teacher'), |
| 191 | - ], function () { |
|
| 191 | + ], function() { |
|
| 192 | 192 | return Teacher::all()->pluck('name', 'id')->toArray(); |
| 193 | - }, function ($value) { // if the filter is active |
|
| 193 | + }, function($value) { // if the filter is active |
|
| 194 | 194 | CRUD::addClause('where', 'teacher_id', $value); |
| 195 | 195 | }, |
| 196 | - function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
| 196 | + function() { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
| 197 | 197 | }); |
| 198 | 198 | |
| 199 | - CRUD::addFilter([ // select2 filter |
|
| 199 | + CRUD::addFilter([// select2 filter |
|
| 200 | 200 | 'name' => 'level_id', |
| 201 | 201 | 'type' => 'select2', |
| 202 | 202 | 'label'=> __('Level'), |
| 203 | - ], function () { |
|
| 203 | + ], function() { |
|
| 204 | 204 | return Level::all()->pluck('name', 'id')->toArray(); |
| 205 | - }, function ($value) { // if the filter is active |
|
| 205 | + }, function($value) { // if the filter is active |
|
| 206 | 206 | CRUD::addClause('where', 'level_id', $value); |
| 207 | 207 | }, |
| 208 | - function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
| 208 | + function() { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
| 209 | 209 | }); |
| 210 | 210 | |
| 211 | - CRUD::addFilter([ // select2 filter |
|
| 211 | + CRUD::addFilter([// select2 filter |
|
| 212 | 212 | 'name' => 'period_id', |
| 213 | 213 | 'type' => 'select2', |
| 214 | 214 | 'label'=> __('Period'), |
| 215 | - ], function () { |
|
| 215 | + ], function() { |
|
| 216 | 216 | return Period::all()->sortByDesc('id')->pluck('name', 'id')->toArray(); |
| 217 | - }, function ($value) { // if the filter is active |
|
| 217 | + }, function($value) { // if the filter is active |
|
| 218 | 218 | CRUD::addClause('where', 'period_id', $value); |
| 219 | 219 | }, |
| 220 | - function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
| 220 | + function() { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
| 221 | 221 | $period = Period::get_default_period()->id; |
| 222 | 222 | CRUD::addClause('where', 'period_id', $period); |
| 223 | 223 | $this->crud->getRequest()->request->add(['period_id' => $period]); // to make the filter look active |