@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | |
40 | 40 | public function canCrudAssistant(string $action, $model = null): bool |
41 | 41 | { |
42 | - if(!in_array($action, ['index', 'create', 'store', 'edit', 'update', 'delete'])) return false; |
|
42 | + if (!in_array($action, ['index', 'create', 'store', 'edit', 'update', 'delete'])) return false; |
|
43 | 43 | |
44 | 44 | try { |
45 | 45 | |
@@ -58,12 +58,12 @@ discard block |
||
58 | 58 | return false; |
59 | 59 | } |
60 | 60 | |
61 | - if(in_array($action, ['index', 'create', 'store'])) return true; |
|
61 | + if (in_array($action, ['index', 'create', 'store'])) return true; |
|
62 | 62 | |
63 | - if(!$model || !$model instanceof StatefulContract) return true; |
|
63 | + if (!$model || !$model instanceof StatefulContract) return true; |
|
64 | 64 | |
65 | 65 | // Model cannot be in deleted state for editing purposes. |
66 | - if(in_array($action, ['edit', 'update'])) { |
|
66 | + if (in_array($action, ['edit', 'update'])) { |
|
67 | 67 | return !($model->stateOf(PageState::KEY) == PageState::DELETED); |
68 | 68 | } |
69 | 69 | |
@@ -101,14 +101,14 @@ discard block |
||
101 | 101 | // Default sorted by publish date |
102 | 102 | $modelClass = $this->managedModelClass(); |
103 | 103 | if (Schema::hasColumn((new $modelClass)->getTable(), 'published_at')) { |
104 | - $filters = $filters->add(HiddenFilter::make('publish', function ($query) { |
|
104 | + $filters = $filters->add(HiddenFilter::make('publish', function($query) { |
|
105 | 105 | return $query->orderBy('published_at', 'DESC'); |
106 | 106 | })); |
107 | 107 | } |
108 | 108 | |
109 | 109 | // if model has no timestamps, updated_at doesn't exist |
110 | 110 | if ((new $modelClass)->timestamps) { |
111 | - $filters = $filters->add(HiddenFilter::make('updated', function ($query) { |
|
111 | + $filters = $filters->add(HiddenFilter::make('updated', function($query) { |
|
112 | 112 | return $query->orderBy('updated_at', 'DESC'); |
113 | 113 | })); |
114 | 114 | } |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | $model->saveFields($model->fields()->tagged('create'), $request->all(), $request->allFiles()); |
143 | 143 | |
144 | 144 | return redirect()->to($this->route('edit', $model)) |
145 | - ->with('messages.success', '<i class="fa fa-fw fa-check-circle"></i> "' . $model->adminLabel('title') . '" is toegevoegd'); |
|
145 | + ->with('messages.success', '<i class="fa fa-fw fa-check-circle"></i> "'.$model->adminLabel('title').'" is toegevoegd'); |
|
146 | 146 | } |
147 | 147 | |
148 | 148 | public function edit(Request $request, $id) |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | $model->saveFields($model->fields(), $request->all(), $request->allFiles()); |
172 | 172 | |
173 | 173 | return redirect()->to($this->route('index')) |
174 | - ->with('messages.success', '<i class="fa fa-fw fa-check-circle"></i> <a href="' . $this->route('edit', $model) . '">' . $model->adminLabel('title') . '</a> is aangepast'); |
|
174 | + ->with('messages.success', '<i class="fa fa-fw fa-check-circle"></i> <a href="'.$this->route('edit', $model).'">'.$model->adminLabel('title').'</a> is aangepast'); |
|
175 | 175 | } |
176 | 176 | |
177 | 177 | public function delete(Request $request, $id) |
@@ -181,12 +181,12 @@ discard block |
||
181 | 181 | $this->guard('delete', $model); |
182 | 182 | |
183 | 183 | if ($request->get('deleteconfirmation') !== 'DELETE') { |
184 | - return redirect()->back()->with('messages.warning', $model->adminLabel('title') . ' is niet verwijderd.'); |
|
184 | + return redirect()->back()->with('messages.warning', $model->adminLabel('title').' is niet verwijderd.'); |
|
185 | 185 | } |
186 | 186 | |
187 | 187 | app(DeleteManagedModel::class)->handle($model); |
188 | 188 | |
189 | 189 | return redirect()->to($this->route('index')) |
190 | - ->with('messages.success', '<i class="fa fa-fw fa-check-circle"></i> "' . $model->adminLabel('title') . '" is verwijderd.'); |
|
190 | + ->with('messages.success', '<i class="fa fa-fw fa-check-circle"></i> "'.$model->adminLabel('title').'" is verwijderd.'); |
|
191 | 191 | } |
192 | 192 | } |
@@ -39,7 +39,9 @@ discard block |
||
39 | 39 | |
40 | 40 | public function canCrudAssistant(string $action, $model = null): bool |
41 | 41 | { |
42 | - if(!in_array($action, ['index', 'create', 'store', 'edit', 'update', 'delete'])) return false; |
|
42 | + if(!in_array($action, ['index', 'create', 'store', 'edit', 'update', 'delete'])) { |
|
43 | + return false; |
|
44 | + } |
|
43 | 45 | |
44 | 46 | try { |
45 | 47 | |
@@ -58,9 +60,13 @@ discard block |
||
58 | 60 | return false; |
59 | 61 | } |
60 | 62 | |
61 | - if(in_array($action, ['index', 'create', 'store'])) return true; |
|
63 | + if(in_array($action, ['index', 'create', 'store'])) { |
|
64 | + return true; |
|
65 | + } |
|
62 | 66 | |
63 | - if(!$model || !$model instanceof StatefulContract) return true; |
|
67 | + if(!$model || !$model instanceof StatefulContract) { |
|
68 | + return true; |
|
69 | + } |
|
64 | 70 | |
65 | 71 | // Model cannot be in deleted state for editing purposes. |
66 | 72 | if(in_array($action, ['edit', 'update'])) { |