@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | * Eager loading relations. |
| 26 | 26 | * @var string[] |
| 27 | 27 | */ |
| 28 | - protected $with = []; |
|
| 28 | + protected $with = [ ]; |
|
| 29 | 29 | |
| 30 | 30 | /** |
| 31 | 31 | * @param string $class |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | */ |
| 73 | 73 | public function with($with) |
| 74 | 74 | { |
| 75 | - if (! is_array($with)) { |
|
| 75 | + if (!is_array($with)) { |
|
| 76 | 76 | $with = func_get_args(); |
| 77 | 77 | } |
| 78 | 78 | |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | public function hasColumn($column) |
| 179 | 179 | { |
| 180 | 180 | $table = $this->getModel()->getTable(); |
| 181 | - $columns = Cache::remember('admin.columns.'.$table, 60, function () use ($table) { |
|
| 181 | + $columns = Cache::remember('admin.columns.'.$table, 60, function() use ($table) { |
|
| 182 | 182 | return Schema::getColumnListing($table); |
| 183 | 183 | }); |
| 184 | 184 | |
@@ -60,7 +60,7 @@ |
||
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | /** |
| 63 | - * @return \string[] |
|
| 63 | + * @return string[] |
|
| 64 | 64 | */ |
| 65 | 65 | public function getWith() |
| 66 | 66 | { |
@@ -62,6 +62,6 @@ |
||
| 62 | 62 | | |
| 63 | 63 | */ |
| 64 | 64 | |
| 65 | - 'attributes' => [], |
|
| 65 | + 'attributes' => [ ], |
|
| 66 | 66 | |
| 67 | 67 | ]; |
@@ -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 | } |
@@ -175,10 +175,10 @@ discard block |
||
| 175 | 175 | if ($extension instanceof Placable) { |
| 176 | 176 | $template = app('sleeping_owl.template')->getViewPath($this->getView()); |
| 177 | 177 | |
| 178 | - view()->composer($template, function (\Illuminate\View\View $view) use ($extension) { |
|
| 178 | + view()->composer($template, function(\Illuminate\View\View $view) use ($extension) { |
|
| 179 | 179 | $html = app('sleeping_owl.template')->view($extension->getView(), $extension->toArray())->render(); |
| 180 | 180 | |
| 181 | - if (! empty($html)) { |
|
| 181 | + if (!empty($html)) { |
|
| 182 | 182 | $view->getFactory()->inject($extension->getPlacement(), $html); |
| 183 | 183 | } |
| 184 | 184 | }); |
@@ -213,9 +213,9 @@ discard block |
||
| 213 | 213 | $this->title, |
| 214 | 214 | ]; |
| 215 | 215 | |
| 216 | - $this->getExtensions()->each(function (DisplayExtensionInterface $extension) use (&$titles) { |
|
| 216 | + $this->getExtensions()->each(function(DisplayExtensionInterface $extension) use (&$titles) { |
|
| 217 | 217 | if (method_exists($extension, $method = 'getTitle')) { |
| 218 | - $titles[] = call_user_func([$extension, $method]); |
|
| 218 | + $titles[ ] = call_user_func([ $extension, $method ]); |
|
| 219 | 219 | } |
| 220 | 220 | }); |
| 221 | 221 | |
@@ -292,7 +292,7 @@ discard block |
||
| 292 | 292 | $extension = $this->extensions->get($method); |
| 293 | 293 | |
| 294 | 294 | if (method_exists($extension, 'set')) { |
| 295 | - return call_user_func_array([$extension, 'set'], $arguments); |
|
| 295 | + return call_user_func_array([ $extension, 'set' ], $arguments); |
|
| 296 | 296 | } |
| 297 | 297 | } |
| 298 | 298 | |
@@ -313,9 +313,9 @@ discard block |
||
| 313 | 313 | */ |
| 314 | 314 | protected function makeRepository() |
| 315 | 315 | { |
| 316 | - $repository = app($this->repositoryClass, [$this->modelClass]); |
|
| 316 | + $repository = app($this->repositoryClass, [ $this->modelClass ]); |
|
| 317 | 317 | |
| 318 | - if (! ($repository instanceof RepositoryInterface)) { |
|
| 318 | + if (!($repository instanceof RepositoryInterface)) { |
|
| 319 | 319 | throw new \Exception('Repository class must be instanced of [RepositoryInterface]'); |
| 320 | 320 | } |
| 321 | 321 | |
@@ -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 | } |
@@ -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', |