@@ -87,6 +87,6 @@ |
||
87 | 87 | | |
88 | 88 | */ |
89 | 89 | |
90 | - 'attributes' => [], |
|
90 | + 'attributes' => [ ], |
|
91 | 91 | |
92 | 92 | ]; |
@@ -87,6 +87,6 @@ |
||
87 | 87 | | |
88 | 88 | */ |
89 | 89 | |
90 | - 'attributes' => [], |
|
90 | + 'attributes' => [ ], |
|
91 | 91 | |
92 | 92 | ]; |
@@ -87,6 +87,6 @@ |
||
87 | 87 | | |
88 | 88 | */ |
89 | 89 | |
90 | - 'attributes' => [], |
|
90 | + 'attributes' => [ ], |
|
91 | 91 | |
92 | 92 | ]; |
@@ -308,7 +308,7 @@ |
||
308 | 308 | } |
309 | 309 | |
310 | 310 | /** |
311 | - * @return \Illuminate\Foundation\Application|mixed |
|
311 | + * @return RepositoryInterface |
|
312 | 312 | * @throws \Exception |
313 | 313 | */ |
314 | 314 | protected function makeRepository() |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | /** |
51 | 51 | * @var array |
52 | 52 | */ |
53 | - protected $with = []; |
|
53 | + protected $with = [ ]; |
|
54 | 54 | |
55 | 55 | /** |
56 | 56 | * @var string |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | $this->repository = $this->makeRepository(); |
168 | 168 | $this->repository->with($this->with); |
169 | 169 | |
170 | - $this->extensions->each(function (DisplayExtensionInterface $extension) { |
|
170 | + $this->extensions->each(function(DisplayExtensionInterface $extension) { |
|
171 | 171 | if ($extension instanceof Initializable) { |
172 | 172 | $extension->initialize(); |
173 | 173 | } |
@@ -201,9 +201,9 @@ discard block |
||
201 | 201 | $this->title, |
202 | 202 | ]; |
203 | 203 | |
204 | - $this->getExtensions()->each(function (DisplayExtensionInterface $extension) use (&$titles) { |
|
204 | + $this->getExtensions()->each(function(DisplayExtensionInterface $extension) use (&$titles) { |
|
205 | 205 | if (method_exists($extension, $method = 'getTitle')) { |
206 | - $titles[] = call_user_func([$extension, $method]); |
|
206 | + $titles[ ] = call_user_func([ $extension, $method ]); |
|
207 | 207 | } |
208 | 208 | }); |
209 | 209 | |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | })->each(function($extension) use($view) { |
271 | 271 | $html = app('sleeping_owl.template')->view($extension->getView(), $extension->toArray())->render(); |
272 | 272 | |
273 | - if (! empty($html)) { |
|
273 | + if (!empty($html)) { |
|
274 | 274 | $factory = $view->getFactory(); |
275 | 275 | |
276 | 276 | $factory->startSection($extension->getPlacement()); |
@@ -306,7 +306,7 @@ discard block |
||
306 | 306 | $extension = $this->extensions->get($method); |
307 | 307 | |
308 | 308 | if (method_exists($extension, 'set')) { |
309 | - return call_user_func_array([$extension, 'set'], $arguments); |
|
309 | + return call_user_func_array([ $extension, 'set' ], $arguments); |
|
310 | 310 | } |
311 | 311 | } |
312 | 312 | |
@@ -327,9 +327,9 @@ discard block |
||
327 | 327 | */ |
328 | 328 | protected function makeRepository() |
329 | 329 | { |
330 | - $repository = app($this->repositoryClass, [$this->modelClass]); |
|
330 | + $repository = app($this->repositoryClass, [ $this->modelClass ]); |
|
331 | 331 | |
332 | - if (! ($repository instanceof RepositoryInterface)) { |
|
332 | + if (!($repository instanceof RepositoryInterface)) { |
|
333 | 333 | throw new \Exception('Repository class must be instanced of [RepositoryInterface]'); |
334 | 334 | } |
335 | 335 |
@@ -145,7 +145,7 @@ |
||
145 | 145 | } |
146 | 146 | |
147 | 147 | /** |
148 | - * @param string|\Illuminate\View\View $view |
|
148 | + * @param string $view |
|
149 | 149 | * |
150 | 150 | * @return $this |
151 | 151 | */ |
@@ -88,10 +88,10 @@ discard block |
||
88 | 88 | $this->controlActive = false; |
89 | 89 | |
90 | 90 | if ($this->isInitialize()) { |
91 | - $this->columns = $this->columns->filter(function ($column) { |
|
91 | + $this->columns = $this->columns->filter(function($column) { |
|
92 | 92 | $class = get_class($this->getControlColumn()); |
93 | 93 | |
94 | - return ! ($column instanceof $class); |
|
94 | + return !($column instanceof $class); |
|
95 | 95 | }); |
96 | 96 | } |
97 | 97 | |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | */ |
114 | 114 | public function set($columns) |
115 | 115 | { |
116 | - if (! is_array($columns)) { |
|
116 | + if (!is_array($columns)) { |
|
117 | 117 | $columns = func_get_args(); |
118 | 118 | } |
119 | 119 | |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | |
180 | 180 | public function initialize() |
181 | 181 | { |
182 | - $this->all()->each(function (ColumnInterface $column) { |
|
182 | + $this->all()->each(function(ColumnInterface $column) { |
|
183 | 183 | $column->initialize(); |
184 | 184 | }); |
185 | 185 | |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | public function render() |
199 | 199 | { |
200 | 200 | $params = $this->toArray(); |
201 | - $params['collection'] = $this->getDisplay()->getCollection(); |
|
201 | + $params[ 'collection' ] = $this->getDisplay()->getCollection(); |
|
202 | 202 | |
203 | 203 | return app('sleeping_owl.template')->view($this->getView(), $params)->render(); |
204 | 204 | } |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | * |
204 | 204 | * @param $id |
205 | 205 | * @param $parentId |
206 | - * @param $left |
|
206 | + * @param integer $left |
|
207 | 207 | * @param $right |
208 | 208 | */ |
209 | 209 | protected function move($id, $parentId, $left, $right) |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | * Call several methods and get first result. |
301 | 301 | * |
302 | 302 | * @param $instance |
303 | - * @param $methods |
|
303 | + * @param string[] $methods |
|
304 | 304 | * |
305 | 305 | * @return mixed |
306 | 306 | * @throws Exception |
@@ -320,9 +320,9 @@ discard block |
||
320 | 320 | * |
321 | 321 | * @param $root |
322 | 322 | * @param $parentId |
323 | - * @param $left |
|
323 | + * @param integer $left |
|
324 | 324 | * |
325 | - * @return mixed |
|
325 | + * @return integer |
|
326 | 326 | */ |
327 | 327 | protected function recursiveReorder($root, $parentId, $left) |
328 | 328 | { |
@@ -341,7 +341,7 @@ discard block |
||
341 | 341 | * Recursive reoder simple tree type. |
342 | 342 | * |
343 | 343 | * @param $data |
344 | - * @param $parentId |
|
344 | + * @param string|null $parentId |
|
345 | 345 | */ |
346 | 346 | protected function recursiveReorderSimple(array $data, $parentId) |
347 | 347 | { |
@@ -363,7 +363,7 @@ discard block |
||
363 | 363 | * Get children for simple tree type structure. |
364 | 364 | * |
365 | 365 | * @param $collection |
366 | - * @param $id |
|
366 | + * @param string|null $id |
|
367 | 367 | * |
368 | 368 | * @return Collection |
369 | 369 | */ |
@@ -385,7 +385,7 @@ discard block |
||
385 | 385 | |
386 | 386 | /** |
387 | 387 | * Create simple tree type structure. |
388 | - * @return static |
|
388 | + * @return Collection |
|
389 | 389 | */ |
390 | 390 | protected function createSimpleTree() |
391 | 391 | { |
@@ -210,9 +210,9 @@ discard block |
||
210 | 210 | { |
211 | 211 | $instance = $this->find($id); |
212 | 212 | $attributes = $instance->getAttributes(); |
213 | - $attributes[$this->getLeftColumn($instance)] = $left; |
|
214 | - $attributes[$this->getRightColumn($instance)] = $right; |
|
215 | - $attributes[$this->getParentColumn($instance)] = $parentId; |
|
213 | + $attributes[ $this->getLeftColumn($instance) ] = $left; |
|
214 | + $attributes[ $this->getRightColumn($instance) ] = $right; |
|
215 | + $attributes[ $this->getParentColumn($instance) ] = $parentId; |
|
216 | 216 | $instance->setRawAttributes($attributes); |
217 | 217 | $instance->save(); |
218 | 218 | } |
@@ -327,11 +327,11 @@ discard block |
||
327 | 327 | protected function recursiveReorder($root, $parentId, $left) |
328 | 328 | { |
329 | 329 | $right = $left + 1; |
330 | - $children = array_get($root, 'children', []); |
|
330 | + $children = array_get($root, 'children', [ ]); |
|
331 | 331 | foreach ($children as $child) { |
332 | - $right = $this->recursiveReorder($child, $root['id'], $right); |
|
332 | + $right = $this->recursiveReorder($child, $root[ 'id' ], $right); |
|
333 | 333 | } |
334 | - $this->move($root['id'], $parentId, $left, $right); |
|
334 | + $this->move($root[ 'id' ], $parentId, $left, $right); |
|
335 | 335 | $left = $right + 1; |
336 | 336 | |
337 | 337 | return $left; |
@@ -346,15 +346,15 @@ discard block |
||
346 | 346 | protected function recursiveReorderSimple(array $data, $parentId) |
347 | 347 | { |
348 | 348 | foreach ($data as $order => $item) { |
349 | - $id = $item['id']; |
|
349 | + $id = $item[ 'id' ]; |
|
350 | 350 | |
351 | 351 | $instance = $this->find($id); |
352 | 352 | $instance->{$this->getParentField()} = $parentId; |
353 | 353 | $instance->{$this->getOrderField()} = $order; |
354 | 354 | $instance->save(); |
355 | 355 | |
356 | - if (isset($item['children'])) { |
|
357 | - $this->recursiveReorderSimple($item['children'], $id); |
|
356 | + if (isset($item[ 'children' ])) { |
|
357 | + $this->recursiveReorderSimple($item[ 'children' ], $id); |
|
358 | 358 | } |
359 | 359 | } |
360 | 360 | } |
@@ -370,14 +370,14 @@ discard block |
||
370 | 370 | protected function getChildren($collection, $id) |
371 | 371 | { |
372 | 372 | $parentField = $this->getParentField(); |
373 | - $result = []; |
|
373 | + $result = [ ]; |
|
374 | 374 | foreach ($collection as $instance) { |
375 | - if ((int)$instance->$parentField != $id) { |
|
375 | + if ((int) $instance->$parentField != $id) { |
|
376 | 376 | continue; |
377 | 377 | } |
378 | 378 | |
379 | 379 | $instance->setRelation('children', $this->getChildren($collection, $instance->getKey())); |
380 | - $result[] = $instance; |
|
380 | + $result[ ] = $instance; |
|
381 | 381 | } |
382 | 382 | |
383 | 383 | return new Collection($result); |
@@ -214,7 +214,7 @@ |
||
214 | 214 | /** |
215 | 215 | * @param $object |
216 | 216 | * |
217 | - * @return mixed |
|
217 | + * @return Model |
|
218 | 218 | */ |
219 | 219 | protected function getElementContainer($object) |
220 | 220 | { |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | |
19 | 19 | public function initializeElements() |
20 | 20 | { |
21 | - $this->getElements()->each(function ($element) { |
|
21 | + $this->getElements()->each(function($element) { |
|
22 | 22 | if ($element instanceof Initializable) { |
23 | 23 | $element->initialize(); |
24 | 24 | } |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | |
37 | 37 | foreach ($this->getElements() as $element) { |
38 | 38 | if ($element instanceof ElementsInterface) { |
39 | - if (! is_null($found = $element->getElement($path))) { |
|
39 | + if (!is_null($found = $element->getElement($path))) { |
|
40 | 40 | return $found; |
41 | 41 | } |
42 | 42 | } |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | */ |
131 | 131 | protected function setModelForElements(Model $model) |
132 | 132 | { |
133 | - $this->getElements()->each(function ($element) use ($model) { |
|
133 | + $this->getElements()->each(function($element) use ($model) { |
|
134 | 134 | $element = $this->getElementContainer($element); |
135 | 135 | if ($element instanceof FormElementInterface) { |
136 | 136 | $element->setModel($model); |
@@ -145,9 +145,9 @@ discard block |
||
145 | 145 | * |
146 | 146 | * @return array |
147 | 147 | */ |
148 | - protected function getValidationRulesFromElements(array $rules = []) |
|
148 | + protected function getValidationRulesFromElements(array $rules = [ ]) |
|
149 | 149 | { |
150 | - $this->getElements()->each(function ($element) use (&$rules) { |
|
150 | + $this->getElements()->each(function($element) use (&$rules) { |
|
151 | 151 | $element = $this->getElementContainer($element); |
152 | 152 | if ($element instanceof FormElementInterface) { |
153 | 153 | $rules += $element->getValidationRules(); |
@@ -162,9 +162,9 @@ discard block |
||
162 | 162 | * |
163 | 163 | * @return array |
164 | 164 | */ |
165 | - protected function getValidationMessagesForElements(array $messages = []) |
|
165 | + protected function getValidationMessagesForElements(array $messages = [ ]) |
|
166 | 166 | { |
167 | - $this->getElements()->each(function ($element) use (&$messages) { |
|
167 | + $this->getElements()->each(function($element) use (&$messages) { |
|
168 | 168 | $element = $this->getElementContainer($element); |
169 | 169 | if ($element instanceof NamedFormElement) { |
170 | 170 | $messages += $element->getValidationMessages(); |
@@ -179,9 +179,9 @@ discard block |
||
179 | 179 | * |
180 | 180 | * @return array |
181 | 181 | */ |
182 | - protected function getValidationLabelsForElements(array $labels = []) |
|
182 | + protected function getValidationLabelsForElements(array $labels = [ ]) |
|
183 | 183 | { |
184 | - $this->getElements()->each(function ($element) use (&$labels) { |
|
184 | + $this->getElements()->each(function($element) use (&$labels) { |
|
185 | 185 | $element = $this->getElementContainer($element); |
186 | 186 | if ($element instanceof NamedFormElement) { |
187 | 187 | $labels += $element->getValidationLabels(); |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | |
194 | 194 | protected function saveElements() |
195 | 195 | { |
196 | - $this->getElements()->each(function ($element) { |
|
196 | + $this->getElements()->each(function($element) { |
|
197 | 197 | $element = $this->getElementContainer($element); |
198 | 198 | if ($element instanceof FormElementInterface) { |
199 | 199 | $element->save(); |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | |
204 | 204 | protected function afterSaveElements() |
205 | 205 | { |
206 | - $this->getElements()->each(function ($element) { |
|
206 | + $this->getElements()->each(function($element) { |
|
207 | 207 | $element = $this->getElementContainer($element); |
208 | 208 | if ($element instanceof FormElementInterface) { |
209 | 209 | $element->afterSave(); |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -$router->group(['as' => 'admin.', 'namespace' => 'SleepingOwl\Admin\Http\Controllers'], function ($router) { |
|
3 | +$router->group([ 'as' => 'admin.', 'namespace' => 'SleepingOwl\Admin\Http\Controllers' ], function($router) { |
|
4 | 4 | $router->get('{adminModel}', [ |
5 | 5 | 'as' => 'model', |
6 | 6 | 'uses' => 'AdminController@getDisplay', |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | |
38 | 38 | $title = $this->option('title'); |
39 | 39 | |
40 | - $this->call('vendor:publish', ['--provider' => SleepingOwlServiceProvider::class]); |
|
40 | + $this->call('vendor:publish', [ '--provider' => SleepingOwlServiceProvider::class ]); |
|
41 | 41 | |
42 | 42 | $this->publishConfig($title); |
43 | 43 | |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | { |
57 | 57 | $directory = config('sleeping_owl.bootstrapDirectory'); |
58 | 58 | |
59 | - if (! is_dir($directory)) { |
|
59 | + if (!is_dir($directory)) { |
|
60 | 60 | $this->files->makeDirectory($directory, 0755, true, true); |
61 | 61 | $this->line('<info>Admin bootstrap directory was created:</info> '.str_replace(base_path(), '', $directory)); |
62 | 62 | } |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | { |
70 | 70 | $file = config('sleeping_owl.bootstrapDirectory').'/navigation.php'; |
71 | 71 | |
72 | - if (! file_exists($file)) { |
|
72 | + if (!file_exists($file)) { |
|
73 | 73 | $contents = $this->files->get(__DIR__.'/stubs/navigation.stub'); |
74 | 74 | $this->files->put($file, $contents); |
75 | 75 | $this->line('<info>Menu file was created:</info> '.str_replace(base_path(), '', $file)); |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | protected function createBootstrapFile() |
83 | 83 | { |
84 | 84 | $file = config('sleeping_owl.bootstrapDirectory').'/bootstrap.php'; |
85 | - if (! file_exists($file)) { |
|
85 | + if (!file_exists($file)) { |
|
86 | 86 | $contents = $this->files->get(__DIR__.'/stubs/bootstrap.stub'); |
87 | 87 | $this->files->put($file, $contents); |
88 | 88 | $this->line('<info>Bootstrap file was created:</info> '.str_replace(base_path(), '', $file)); |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | protected function createRoutesFile() |
101 | 101 | { |
102 | 102 | $file = config('sleeping_owl.bootstrapDirectory').'/routes.php'; |
103 | - if (! file_exists($file)) { |
|
103 | + if (!file_exists($file)) { |
|
104 | 104 | $contents = $this->files->get(__DIR__.'/stubs/routes.stub'); |
105 | 105 | $this->files->put($file, $contents); |
106 | 106 | $this->line('<info>Bootstrap file was created:</info> '.str_replace(base_path(), '', $file)); |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | protected function createPublicDefaultStructure() |
114 | 114 | { |
115 | 115 | $uploadsDirectory = public_path('images/uploads'); |
116 | - if (! is_dir($uploadsDirectory)) { |
|
116 | + if (!is_dir($uploadsDirectory)) { |
|
117 | 117 | $this->files->makeDirectory($uploadsDirectory, 0755, true, true); |
118 | 118 | } |
119 | 119 | } |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | { |
128 | 128 | $file = config_path('sleeping_owl.php'); |
129 | 129 | |
130 | - if (! is_null($title)) { |
|
130 | + if (!is_null($title)) { |
|
131 | 131 | $contents = $this->files->get($file); |
132 | 132 | $contents = str_replace('Sleeping Owl administrator', $title, $contents); |
133 | 133 | $this->files->put($file, $contents); |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | protected function getOptions() |
142 | 142 | { |
143 | 143 | return [ |
144 | - ['title', null, InputOption::VALUE_REQUIRED, 'Title for admin module.'], |
|
144 | + [ 'title', null, InputOption::VALUE_REQUIRED, 'Title for admin module.' ], |
|
145 | 145 | ]; |
146 | 146 | } |
147 | 147 | } |