@@ -36,7 +36,7 @@ |
||
36 | 36 | */ |
37 | 37 | public function canShow() |
38 | 38 | { |
39 | - if (is_null($this->getModel()->getKey()) || ! $this->show) { |
|
39 | + if (is_null($this->getModel()->getKey()) || !$this->show) { |
|
40 | 40 | return false; |
41 | 41 | } |
42 | 42 |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | public static function registerRoutes(Router $router) |
24 | 24 | { |
25 | 25 | $routeName = 'admin.display.tree.reorder'; |
26 | - if (! $router->has($routeName)) { |
|
26 | + if (!$router->has($routeName)) { |
|
27 | 27 | $router->post('{adminModel}/reorder', |
28 | 28 | ['as' => $routeName, 'uses' => 'SleepingOwl\Admin\Http\Controllers\DisplayController@treeReorder']); |
29 | 29 | } |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | if ($this->getParentField()) { |
119 | 119 | $repository = $repository->setParentField($this->getParentField()); |
120 | 120 | } |
121 | - if (! is_null($this->treeType)) { |
|
121 | + if (!is_null($this->treeType)) { |
|
122 | 122 | $repository->setTreeType($this->treeType); |
123 | 123 | } |
124 | 124 | |
@@ -340,11 +340,11 @@ discard block |
||
340 | 340 | */ |
341 | 341 | public function getCollection() |
342 | 342 | { |
343 | - if (! $this->isInitialized()) { |
|
343 | + if (!$this->isInitialized()) { |
|
344 | 344 | throw new \Exception('Display is not initialized'); |
345 | 345 | } |
346 | 346 | |
347 | - if (! is_null($this->collection)) { |
|
347 | + if (!is_null($this->collection)) { |
|
348 | 348 | return $this->collection; |
349 | 349 | } |
350 | 350 | |
@@ -375,7 +375,7 @@ discard block |
||
375 | 375 | { |
376 | 376 | $repository = parent::makeRepository(); |
377 | 377 | |
378 | - if (! ($repository instanceof TreeRepositoryInterface)) { |
|
378 | + if (!($repository instanceof TreeRepositoryInterface)) { |
|
379 | 379 | throw new \Exception('Repository class must be instanced of [TreeRepositoryInterface]'); |
380 | 380 | } |
381 | 381 |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | } |
68 | 68 | } |
69 | 69 | |
70 | - $activeTabs = $this->getTabs()->filter(function (TabInterface $tab) { |
|
70 | + $activeTabs = $this->getTabs()->filter(function(TabInterface $tab) { |
|
71 | 71 | return $tab->isActive(); |
72 | 72 | })->count(); |
73 | 73 | |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | */ |
96 | 96 | public function setModelClass($class) |
97 | 97 | { |
98 | - $this->getTabs()->each(function (TabInterface $tab) use ($class) { |
|
98 | + $this->getTabs()->each(function(TabInterface $tab) use ($class) { |
|
99 | 99 | if ($tab instanceof DisplayInterface) { |
100 | 100 | $tab->setModelClass($class); |
101 | 101 | } |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | */ |
180 | 180 | public function setAction($action) |
181 | 181 | { |
182 | - $this->getTabs()->each(function (TabInterface $tab) use ($action) { |
|
182 | + $this->getTabs()->each(function(TabInterface $tab) use ($action) { |
|
183 | 183 | if ($tab instanceof FormInterface) { |
184 | 184 | $tab->setAction($action); |
185 | 185 | } |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | */ |
196 | 196 | public function setId($id) |
197 | 197 | { |
198 | - $this->getTabs()->each(function (TabInterface $tab) use ($id) { |
|
198 | + $this->getTabs()->each(function(TabInterface $tab) use ($id) { |
|
199 | 199 | if ($tab instanceof FormInterface) { |
200 | 200 | $tab->setId($id); |
201 | 201 | } |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | */ |
213 | 213 | public function validateForm(\Illuminate\Http\Request $request, ModelConfigurationInterface $model = null) |
214 | 214 | { |
215 | - $this->getTabs()->each(function ($tab) use ($request, $model) { |
|
215 | + $this->getTabs()->each(function($tab) use ($request, $model) { |
|
216 | 216 | $tabId = $request->get('sleeping_owl_tab_id'); |
217 | 217 | |
218 | 218 | if ($tab instanceof FormInterface && $tab->getName() == $tabId) { |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | */ |
230 | 230 | public function saveForm(\Illuminate\Http\Request $request, ModelConfigurationInterface $model = null) |
231 | 231 | { |
232 | - $this->getTabs()->each(function (TabInterface $tab) use ($request, $model) { |
|
232 | + $this->getTabs()->each(function(TabInterface $tab) use ($request, $model) { |
|
233 | 233 | $tabId = $request->get('sleeping_owl_tab_id'); |
234 | 234 | |
235 | 235 | if ($tab instanceof FormInterface && $tab->getName() == $tabId) { |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | */ |
60 | 60 | protected function registerModelBindings(Collection $aliases) |
61 | 61 | { |
62 | - $this->router->bind('adminModel', function ($model, Route $route) use ($aliases) { |
|
62 | + $this->router->bind('adminModel', function($model, Route $route) use ($aliases) { |
|
63 | 63 | if (is_null($model = $aliases->get($model))) { |
64 | 64 | throw new ModelNotFoundException(); |
65 | 65 | } |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | */ |
86 | 86 | protected function runCustomController(Route $route, $controller, $action) |
87 | 87 | { |
88 | - $route->uses(function () use ($route, $controller, $action) { |
|
88 | + $route->uses(function() use ($route, $controller, $action) { |
|
89 | 89 | return (new ControllerDispatcher($this->app))->dispatch( |
90 | 90 | $route, $this->app->make($controller), $action |
91 | 91 | ); |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | */ |
31 | 31 | public function setAliasesId(Collection $pages) |
32 | 32 | { |
33 | - $pages->each(function (PageInterface $page) { |
|
33 | + $pages->each(function(PageInterface $page) { |
|
34 | 34 | $page->setAliasId(); |
35 | 35 | |
36 | 36 | if ($page->getPages()->count()) { |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | */ |
55 | 55 | protected function findPageByAliasId(Collection $pages, $url) |
56 | 56 | { |
57 | - $pages->each(function (PageInterface $page) use ($url) { |
|
57 | + $pages->each(function(PageInterface $page) use ($url) { |
|
58 | 58 | $urlPath = parse_url($url, PHP_URL_PATH); |
59 | 59 | |
60 | 60 | if (Route::current()) { |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | */ |
87 | 87 | protected function findActivePage() |
88 | 88 | { |
89 | - if (! is_null($this->currentPage)) { |
|
89 | + if (!is_null($this->currentPage)) { |
|
90 | 90 | return true; |
91 | 91 | } |
92 | 92 | |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | |
97 | 97 | $this->findActive($url, $foundPages); |
98 | 98 | |
99 | - if (! is_null($this->currentPage)) { |
|
99 | + if (!is_null($this->currentPage)) { |
|
100 | 100 | $this->currentPage->setActive(); |
101 | 101 | } |
102 | 102 |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | $modelForOptions = app($modelForOptions); |
65 | 65 | } |
66 | 66 | |
67 | - if (! ($modelForOptions instanceof Model)) { |
|
67 | + if (!($modelForOptions instanceof Model)) { |
|
68 | 68 | throw new SelectException('Class must be instanced of Illuminate\Database\Eloquent\Model'); |
69 | 69 | } |
70 | 70 | |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | */ |
122 | 122 | public function setFetchColumns($columns) |
123 | 123 | { |
124 | - if (! is_array($columns)) { |
|
124 | + if (!is_array($columns)) { |
|
125 | 125 | $columns = func_get_args(); |
126 | 126 | } |
127 | 127 | |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | |
217 | 217 | $options = $repository->getQuery(); |
218 | 218 | |
219 | - if ($this->isEmptyRelation() && ! is_null($foreignKey = $this->getForeignKey())) { |
|
219 | + if ($this->isEmptyRelation() && !is_null($foreignKey = $this->getForeignKey())) { |
|
220 | 220 | $relation = $this->getModelAttributeKey(); |
221 | 221 | $model = $this->getModel(); |
222 | 222 | |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | } |
233 | 233 | |
234 | 234 | // call the pre load options query preparer if has be set |
235 | - if (! is_null($preparer = $this->getLoadOptionsQueryPreparer())) { |
|
235 | + if (!is_null($preparer = $this->getLoadOptionsQueryPreparer())) { |
|
236 | 236 | $options = $preparer($this, $options); |
237 | 237 | } |
238 | 238 | |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | |
247 | 247 | // iterate for all options and redefine it as |
248 | 248 | // list of KEY and TEXT pair |
249 | - $options = array_map(function ($opt) use ($key, $makeDisplay) { |
|
249 | + $options = array_map(function($opt) use ($key, $makeDisplay) { |
|
250 | 250 | // get the KEY and make the display text |
251 | 251 | return [data_get($opt, $key), $makeDisplay($opt)]; |
252 | 252 | }, $options); |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | */ |
24 | 24 | public function initializeElements() |
25 | 25 | { |
26 | - $this->getElements()->each(function ($element) { |
|
26 | + $this->getElements()->each(function($element) { |
|
27 | 27 | if ($element instanceof Initializable) { |
28 | 28 | $element->initialize(); |
29 | 29 | } |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | |
42 | 42 | foreach ($this->getElements() as $element) { |
43 | 43 | if ($element instanceof ElementsInterface) { |
44 | - if (! is_null($found = $element->getElement($path))) { |
|
44 | + if (!is_null($found = $element->getElement($path))) { |
|
45 | 45 | return $found; |
46 | 46 | } |
47 | 47 | } |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | */ |
146 | 146 | protected function setModelForElements(Model $model) |
147 | 147 | { |
148 | - $this->getElements()->each(function ($element) use ($model) { |
|
148 | + $this->getElements()->each(function($element) use ($model) { |
|
149 | 149 | $element = $this->getElementContainer($element); |
150 | 150 | |
151 | 151 | if ($element instanceof WithModelInterface) { |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | */ |
164 | 164 | protected function getValidationRulesFromElements(array $rules = []) |
165 | 165 | { |
166 | - $this->getElements()->onlyActive()->each(function ($element) use (&$rules) { |
|
166 | + $this->getElements()->onlyActive()->each(function($element) use (&$rules) { |
|
167 | 167 | $element = $this->getElementContainer($element); |
168 | 168 | |
169 | 169 | if ($element instanceof Validable) { |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | */ |
182 | 182 | protected function getValidationMessagesForElements(array $messages = []) |
183 | 183 | { |
184 | - $this->getElements()->onlyActive()->each(function ($element) use (&$messages) { |
|
184 | + $this->getElements()->onlyActive()->each(function($element) use (&$messages) { |
|
185 | 185 | $element = $this->getElementContainer($element); |
186 | 186 | |
187 | 187 | if ($element instanceof Validable) { |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | */ |
200 | 200 | protected function getValidationLabelsForElements(array $labels = []) |
201 | 201 | { |
202 | - $this->getElements()->onlyActive()->each(function ($element) use (&$labels) { |
|
202 | + $this->getElements()->onlyActive()->each(function($element) use (&$labels) { |
|
203 | 203 | $element = $this->getElementContainer($element); |
204 | 204 | |
205 | 205 | if ($element instanceof Validable) { |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | */ |
218 | 218 | protected function saveElements(\Illuminate\Http\Request $request) |
219 | 219 | { |
220 | - $this->getElements()->onlyActive()->each(function ($element) use ($request) { |
|
220 | + $this->getElements()->onlyActive()->each(function($element) use ($request) { |
|
221 | 221 | $element = $this->getElementContainer($element); |
222 | 222 | |
223 | 223 | if ($element instanceof FormElementInterface) { |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | */ |
234 | 234 | protected function afterSaveElements(\Illuminate\Http\Request $request) |
235 | 235 | { |
236 | - $this->getElements()->onlyActive()->each(function ($element) use ($request) { |
|
236 | + $this->getElements()->onlyActive()->each(function($element) use ($request) { |
|
237 | 237 | $element = $this->getElementContainer($element); |
238 | 238 | |
239 | 239 | if ($element instanceof FormElementInterface) { |
@@ -2,8 +2,8 @@ |
||
2 | 2 | |
3 | 3 | use Illuminate\Routing\Router; |
4 | 4 | |
5 | -$router->group(['as' => 'admin.', 'namespace' => 'SleepingOwl\Admin\Http\Controllers'], function (Router $router) { |
|
6 | - if (! $router->has('admin.dashboard')) { |
|
5 | +$router->group(['as' => 'admin.', 'namespace' => 'SleepingOwl\Admin\Http\Controllers'], function(Router $router) { |
|
6 | + if (!$router->has('admin.dashboard')) { |
|
7 | 7 | $router->get('', ['as' => 'dashboard', 'uses' => 'AdminController@getDashboard']); |
8 | 8 | } |
9 | 9 |
@@ -18,9 +18,9 @@ discard block |
||
18 | 18 | */ |
19 | 19 | public function getModelLogic(ModelConfigurationInterface $model, $id = null) |
20 | 20 | { |
21 | - if (! is_null($id)) { |
|
21 | + if (!is_null($id)) { |
|
22 | 22 | $item = $model->getRepository()->find($id); |
23 | - if (is_null($item) || ! $model->isEditable($item)) { |
|
23 | + if (is_null($item) || !$model->isEditable($item)) { |
|
24 | 24 | return new JsonResponse([ |
25 | 25 | 'message' => trans('lang.message.access_denied'), |
26 | 26 | ], 403); |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | return $model->fireEdit($id); |
30 | 30 | } |
31 | 31 | |
32 | - if (! $model->isCreatable()) { |
|
32 | + if (!$model->isCreatable()) { |
|
33 | 33 | return new JsonResponse([ |
34 | 34 | 'message' => trans('lang.message.access_denied'), |
35 | 35 | ], 403); |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | } |
75 | 75 | |
76 | 76 | return new JsonResponse([ |
77 | - 'output' => collect($options)->map(function ($value, $key) { |
|
77 | + 'output' => collect($options)->map(function($value, $key) { |
|
78 | 78 | return ['id' => $key, 'name' => $value]; |
79 | 79 | }), |
80 | 80 | 'selected' => $element->getValueFromModel(), |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | return new JsonResponse( |
127 | 127 | $model::where($request->search, 'like', "%{$request->q}%") |
128 | 128 | ->get() |
129 | - ->map(function (Model $item) use ($field) { |
|
129 | + ->map(function(Model $item) use ($field) { |
|
130 | 130 | return [ |
131 | 131 | 'tag_name' => $item->{$field}, |
132 | 132 | 'id' => $item->id, |