@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | /** |
| 17 | 17 | * @var ModelConfigurationInterface[] |
| 18 | 18 | */ |
| 19 | - protected $models = []; |
|
| 19 | + protected $models = [ ]; |
|
| 20 | 20 | |
| 21 | 21 | /** |
| 22 | 22 | * @var TemplateInterface |
@@ -26,14 +26,14 @@ discard block |
||
| 26 | 26 | /** |
| 27 | 27 | * @var Page[] |
| 28 | 28 | */ |
| 29 | - protected $menuItems = []; |
|
| 29 | + protected $menuItems = [ ]; |
|
| 30 | 30 | |
| 31 | 31 | /** |
| 32 | 32 | * @return string[] |
| 33 | 33 | */ |
| 34 | 34 | public function modelAliases() |
| 35 | 35 | { |
| 36 | - return array_map(function (ModelConfigurationInterface $model) { |
|
| 36 | + return array_map(function(ModelConfigurationInterface $model) { |
|
| 37 | 37 | return $model->getAlias(); |
| 38 | 38 | }, $this->getModels()); |
| 39 | 39 | } |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | $class = get_class($class); |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | - if (! $this->hasModel($class)) { |
|
| 84 | + if (!$this->hasModel($class)) { |
|
| 85 | 85 | $this->registerModel($class); |
| 86 | 86 | } |
| 87 | 87 | |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | */ |
| 113 | 113 | public function setModel($class, ModelConfigurationInterface $model) |
| 114 | 114 | { |
| 115 | - $this->models[$class] = $model; |
|
| 115 | + $this->models[ $class ] = $model; |
|
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | /** |
@@ -148,7 +148,7 @@ |
||
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | /** |
| 151 | - * @param string|Renderable $content |
|
| 151 | + * @param string $content |
|
| 152 | 152 | * @param string|null $title |
| 153 | 153 | * |
| 154 | 154 | * @return \Illuminate\View\View|\Illuminate\Contracts\View\Factory |
@@ -11,6 +11,6 @@ |
||
| 11 | 11 | */ |
| 12 | 12 | public function apply(Builder $query) |
| 13 | 13 | { |
| 14 | - call_user_func([$query, $this->getName()], $this->getValue()); |
|
| 14 | + call_user_func([ $query, $this->getName() ], $this->getValue()); |
|
| 15 | 15 | } |
| 16 | 16 | } |
@@ -54,7 +54,7 @@ |
||
| 54 | 54 | */ |
| 55 | 55 | public function setModel($model) |
| 56 | 56 | { |
| 57 | - if (! class_exists($model)) { |
|
| 57 | + if (!class_exists($model)) { |
|
| 58 | 58 | throw new Exception("Class model [$model] not found"); |
| 59 | 59 | } |
| 60 | 60 | |
@@ -11,12 +11,12 @@ discard block |
||
| 11 | 11 | /** |
| 12 | 12 | * @var array |
| 13 | 13 | */ |
| 14 | - protected $order = [[0, 'asc']]; |
|
| 14 | + protected $order = [ [ 0, 'asc' ] ]; |
|
| 15 | 15 | |
| 16 | 16 | /** |
| 17 | 17 | * @var array |
| 18 | 18 | */ |
| 19 | - protected $datatableAttributes = []; |
|
| 19 | + protected $datatableAttributes = [ ]; |
|
| 20 | 20 | |
| 21 | 21 | /** |
| 22 | 22 | * @var int |
@@ -39,12 +39,12 @@ discard block |
||
| 39 | 39 | $this->setHtmlAttribute('data-order', json_encode($this->getOrder())); |
| 40 | 40 | |
| 41 | 41 | $attributes = $this->getDatatableAttributes(); |
| 42 | - $attributes['pageLength'] = $this->paginate; |
|
| 42 | + $attributes[ 'pageLength' ] = $this->paginate; |
|
| 43 | 43 | |
| 44 | - $attributes['language'] = trans('sleeping_owl::lang.table'); |
|
| 44 | + $attributes[ 'language' ] = trans('sleeping_owl::lang.table'); |
|
| 45 | 45 | |
| 46 | 46 | foreach ($this->getColumns()->all() as $column) { |
| 47 | - $attributes['columns'][] = [ |
|
| 47 | + $attributes[ 'columns' ][ ] = [ |
|
| 48 | 48 | 'orderDataType' => class_basename($column), |
| 49 | 49 | ]; |
| 50 | 50 | } |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | */ |
| 58 | 58 | public function getDatatableAttributes() |
| 59 | 59 | { |
| 60 | - return array_merge(config('sleeping_owl.datatables', []), (array) $this->datatableAttributes); |
|
| 60 | + return array_merge(config('sleeping_owl.datatables', [ ]), (array) $this->datatableAttributes); |
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | /** |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | */ |
| 88 | 88 | public function setOrder($order) |
| 89 | 89 | { |
| 90 | - if (! is_array($order)) { |
|
| 90 | + if (!is_array($order)) { |
|
| 91 | 91 | $order = func_get_args(); |
| 92 | 92 | } |
| 93 | 93 | |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | { |
| 123 | 123 | $params = parent::toArray(); |
| 124 | 124 | |
| 125 | - $params['order'] = $this->getOrder(); |
|
| 125 | + $params[ 'order' ] = $this->getOrder(); |
|
| 126 | 126 | |
| 127 | 127 | return $params; |
| 128 | 128 | } |
@@ -13,7 +13,6 @@ |
||
| 13 | 13 | |
| 14 | 14 | /** |
| 15 | 15 | * Class DisplayTable. |
| 16 | - |
|
| 17 | 16 | * @method Columns getColumns() |
| 18 | 17 | * @method $this setColumns(ColumnInterface $column, ... $columns) |
| 19 | 18 | * |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | /** |
| 32 | 32 | * @var array |
| 33 | 33 | */ |
| 34 | - protected $parameters = []; |
|
| 34 | + protected $parameters = [ ]; |
|
| 35 | 35 | |
| 36 | 36 | /** |
| 37 | 37 | * @var int|null |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | parent::initialize(); |
| 73 | 73 | |
| 74 | 74 | if ($this->getModelConfiguration()->isRestorableModel()) { |
| 75 | - $this->setApply(function ($q) { |
|
| 75 | + $this->setApply(function($q) { |
|
| 76 | 76 | return $q->withTrashed(); |
| 77 | 77 | }); |
| 78 | 78 | } |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | */ |
| 133 | 133 | public function setParameter($key, $value) |
| 134 | 134 | { |
| 135 | - $this->parameters[$key] = $value; |
|
| 135 | + $this->parameters[ $key ] = $value; |
|
| 136 | 136 | |
| 137 | 137 | return $this; |
| 138 | 138 | } |
@@ -178,19 +178,19 @@ discard block |
||
| 178 | 178 | |
| 179 | 179 | $params = parent::toArray(); |
| 180 | 180 | |
| 181 | - $params['creatable'] = $model->isCreatable(); |
|
| 182 | - $params['createUrl'] = $model->getCreateUrl($this->getParameters() + Request::all()); |
|
| 183 | - $params['collection'] = $this->getCollection(); |
|
| 181 | + $params[ 'creatable' ] = $model->isCreatable(); |
|
| 182 | + $params[ 'createUrl' ] = $model->getCreateUrl($this->getParameters() + Request::all()); |
|
| 183 | + $params[ 'collection' ] = $this->getCollection(); |
|
| 184 | 184 | |
| 185 | - $params['extensions'] = $this->getExtensions() |
|
| 186 | - ->filter(function (DisplayExtensionInterface $ext) { |
|
| 185 | + $params[ 'extensions' ] = $this->getExtensions() |
|
| 186 | + ->filter(function(DisplayExtensionInterface $ext) { |
|
| 187 | 187 | return $ext instanceof Renderable; |
| 188 | 188 | }) |
| 189 | - ->sortBy(function (DisplayExtensionInterface $extension) { |
|
| 189 | + ->sortBy(function(DisplayExtensionInterface $extension) { |
|
| 190 | 190 | return $extension->getOrder(); |
| 191 | 191 | }); |
| 192 | 192 | |
| 193 | - $params['newEntryButtonText'] = $this->getNewEntryButtonText(); |
|
| 193 | + $params[ 'newEntryButtonText' ] = $this->getNewEntryButtonText(); |
|
| 194 | 194 | |
| 195 | 195 | return $params; |
| 196 | 196 | } |
@@ -201,11 +201,11 @@ discard block |
||
| 201 | 201 | */ |
| 202 | 202 | public function getCollection() |
| 203 | 203 | { |
| 204 | - if (! $this->isInitialized()) { |
|
| 204 | + if (!$this->isInitialized()) { |
|
| 205 | 205 | throw new \Exception('Display is not initialized'); |
| 206 | 206 | } |
| 207 | 207 | |
| 208 | - if (! is_null($this->collection)) { |
|
| 208 | + if (!is_null($this->collection)) { |
|
| 209 | 209 | return $this->collection; |
| 210 | 210 | } |
| 211 | 211 | |
@@ -215,7 +215,7 @@ discard block |
||
| 215 | 215 | $this->applyOrders($query); |
| 216 | 216 | |
| 217 | 217 | return $this->collection = $this->usePagination() |
| 218 | - ? $query->paginate($this->paginate, ['*'], $this->pageName)->appends(request()->except($this->pageName)) |
|
| 218 | + ? $query->paginate($this->paginate, [ '*' ], $this->pageName)->appends(request()->except($this->pageName)) |
|
| 219 | 219 | : $query->get(); |
| 220 | 220 | } |
| 221 | 221 | |
@@ -226,19 +226,19 @@ discard block |
||
| 226 | 226 | */ |
| 227 | 227 | protected function applyOrders(Builder $query) |
| 228 | 228 | { |
| 229 | - $orders = Request::input('order', []); |
|
| 229 | + $orders = Request::input('order', [ ]); |
|
| 230 | 230 | |
| 231 | 231 | $columns = $this->getColumns()->all(); |
| 232 | 232 | |
| 233 | - if (! is_int(key($orders))) { |
|
| 234 | - $orders = [$orders]; |
|
| 233 | + if (!is_int(key($orders))) { |
|
| 234 | + $orders = [ $orders ]; |
|
| 235 | 235 | } |
| 236 | 236 | |
| 237 | 237 | foreach ($orders as $order) { |
| 238 | 238 | $columnIndex = array_get($order, 'column'); |
| 239 | 239 | $direction = array_get($order, 'dir', 'asc'); |
| 240 | 240 | |
| 241 | - if (! $columnIndex && $columnIndex !== '0') { |
|
| 241 | + if (!$columnIndex && $columnIndex !== '0') { |
|
| 242 | 242 | continue; |
| 243 | 243 | } |
| 244 | 244 | |
@@ -255,7 +255,7 @@ discard block |
||
| 255 | 255 | */ |
| 256 | 256 | protected function modifyQuery(\Illuminate\Database\Eloquent\Builder $query) |
| 257 | 257 | { |
| 258 | - $this->extensions->each(function (DisplayExtensionInterface $extension) use ($query) { |
|
| 258 | + $this->extensions->each(function(DisplayExtensionInterface $extension) use ($query) { |
|
| 259 | 259 | $extension->modifyQuery($query); |
| 260 | 260 | }); |
| 261 | 261 | } |
@@ -89,9 +89,9 @@ |
||
| 89 | 89 | parent::initialize(); |
| 90 | 90 | |
| 91 | 91 | $this->getRepository() |
| 92 | - ->setParentField($this->getParentField()) |
|
| 93 | - ->setOrderField($this->getOrderField()) |
|
| 94 | - ->setRootParentId($this->getRootParentId()); |
|
| 92 | + ->setParentField($this->getParentField()) |
|
| 93 | + ->setOrderField($this->getOrderField()) |
|
| 94 | + ->setRootParentId($this->getRootParentId()); |
|
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | /** |
@@ -289,7 +289,7 @@ discard block |
||
| 289 | 289 | } |
| 290 | 290 | |
| 291 | 291 | /** |
| 292 | - * @param \Illuminate\Database\Eloquent\Builder|Builder $query |
|
| 292 | + * @param \Illuminate\Database\Eloquent\Builder $query |
|
| 293 | 293 | */ |
| 294 | 294 | protected function modifyQuery(\Illuminate\Database\Eloquent\Builder $query) |
| 295 | 295 | { |
@@ -299,7 +299,7 @@ discard block |
||
| 299 | 299 | } |
| 300 | 300 | |
| 301 | 301 | /** |
| 302 | - * @return \Illuminate\Foundation\Application|mixed |
|
| 302 | + * @return TreeRepositoryInterface |
|
| 303 | 303 | * @throws \Exception |
| 304 | 304 | */ |
| 305 | 305 | protected function makeRepository() |
@@ -23,12 +23,12 @@ discard block |
||
| 23 | 23 | public static function registerRoutes(Router $router) |
| 24 | 24 | { |
| 25 | 25 | $routeName = 'admin.display.tree.reorder'; |
| 26 | - if (! $router->has($routeName)) { |
|
| 27 | - $router->post('{adminModel}/reorder', ['as' => $routeName, function (ModelConfigurationInterface $model) { |
|
| 26 | + if (!$router->has($routeName)) { |
|
| 27 | + $router->post('{adminModel}/reorder', [ 'as' => $routeName, function(ModelConfigurationInterface $model) { |
|
| 28 | 28 | $display = $model->fireDisplay(); |
| 29 | 29 | |
| 30 | 30 | if ($display instanceof DisplayTabbed) { |
| 31 | - $display->getTabs()->each(function ($tab) { |
|
| 31 | + $display->getTabs()->each(function($tab) { |
|
| 32 | 32 | $content = $tab->getContent(); |
| 33 | 33 | if ($content instanceof self) { |
| 34 | 34 | $content->getRepository()->reorder( |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | Request::input('data') |
| 42 | 42 | ); |
| 43 | 43 | } |
| 44 | - }]); |
|
| 44 | + } ]); |
|
| 45 | 45 | } |
| 46 | 46 | } |
| 47 | 47 | |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | /** |
| 54 | 54 | * @var array |
| 55 | 55 | */ |
| 56 | - protected $parameters = []; |
|
| 56 | + protected $parameters = [ ]; |
|
| 57 | 57 | |
| 58 | 58 | /** |
| 59 | 59 | * @var bool |
@@ -221,7 +221,7 @@ discard block |
||
| 221 | 221 | */ |
| 222 | 222 | public function setParameter($key, $value) |
| 223 | 223 | { |
| 224 | - $this->parameters[$key] = $value; |
|
| 224 | + $this->parameters[ $key ] = $value; |
|
| 225 | 225 | |
| 226 | 226 | return $this; |
| 227 | 227 | } |
@@ -268,7 +268,7 @@ discard block |
||
| 268 | 268 | 'value' => $this->getValue(), |
| 269 | 269 | 'creatable' => $model->isCreatable(), |
| 270 | 270 | 'createUrl' => $model->getCreateUrl($this->getParameters() + Request::all()), |
| 271 | - 'controls' => [app('sleeping_owl.table.column')->treeControl()], |
|
| 271 | + 'controls' => [ app('sleeping_owl.table.column')->treeControl() ], |
|
| 272 | 272 | ]; |
| 273 | 273 | } |
| 274 | 274 | |
@@ -286,11 +286,11 @@ discard block |
||
| 286 | 286 | */ |
| 287 | 287 | public function getCollection() |
| 288 | 288 | { |
| 289 | - if (! $this->isInitialized()) { |
|
| 289 | + if (!$this->isInitialized()) { |
|
| 290 | 290 | throw new \Exception('Display is not initialized'); |
| 291 | 291 | } |
| 292 | 292 | |
| 293 | - if (! is_null($this->collection)) { |
|
| 293 | + if (!is_null($this->collection)) { |
|
| 294 | 294 | return $this->collection; |
| 295 | 295 | } |
| 296 | 296 | |
@@ -310,7 +310,7 @@ discard block |
||
| 310 | 310 | */ |
| 311 | 311 | protected function modifyQuery(\Illuminate\Database\Eloquent\Builder $query) |
| 312 | 312 | { |
| 313 | - $this->extensions->each(function (DisplayExtensionInterface $extension) use ($query) { |
|
| 313 | + $this->extensions->each(function(DisplayExtensionInterface $extension) use ($query) { |
|
| 314 | 314 | $extension->modifyQuery($query); |
| 315 | 315 | }); |
| 316 | 316 | } |
@@ -323,7 +323,7 @@ discard block |
||
| 323 | 323 | { |
| 324 | 324 | $repository = parent::makeRepository(); |
| 325 | 325 | |
| 326 | - if (! ($repository instanceof TreeRepositoryInterface)) { |
|
| 326 | + if (!($repository instanceof TreeRepositoryInterface)) { |
|
| 327 | 327 | throw new \Exception('Repository class must be instanced of [TreeRepositoryInterface]'); |
| 328 | 328 | } |
| 329 | 329 | |
@@ -66,7 +66,7 @@ |
||
| 66 | 66 | $parts = explode('.', $name); |
| 67 | 67 | $fieldName = array_pop($parts); |
| 68 | 68 | $relationName = implode('.', $parts); |
| 69 | - $query->whereHas($relationName, function ($q) use ($search, $fieldName) { |
|
| 69 | + $query->whereHas($relationName, function($q) use ($search, $fieldName) { |
|
| 70 | 70 | $this->buildQuery($q, $fieldName, $search); |
| 71 | 71 | }); |
| 72 | 72 | } |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | /** |
| 29 | 29 | * @var array |
| 30 | 30 | */ |
| 31 | - protected $options = []; |
|
| 31 | + protected $options = [ ]; |
|
| 32 | 32 | |
| 33 | 33 | /** |
| 34 | 34 | * @var string |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | $model = new $model; |
| 61 | 61 | } |
| 62 | 62 | |
| 63 | - if (! ($model instanceof Model)) { |
|
| 63 | + if (!($model instanceof Model)) { |
|
| 64 | 64 | throw new \Exception('Model must be an instance of Illuminate\Database\Eloquent\Model'); |
| 65 | 65 | } |
| 66 | 66 | |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | */ |
| 115 | 115 | public function getOptions() |
| 116 | 116 | { |
| 117 | - if (! is_null($this->getModel()) and ! is_null($this->getDisplay())) { |
|
| 117 | + if (!is_null($this->getModel()) and !is_null($this->getDisplay())) { |
|
| 118 | 118 | $this->loadOptions(); |
| 119 | 119 | } |
| 120 | 120 | |
@@ -200,7 +200,7 @@ discard block |
||
| 200 | 200 | $parts = explode('.', $name); |
| 201 | 201 | $fieldName = array_pop($parts); |
| 202 | 202 | $relationName = implode('.', $parts); |
| 203 | - $query->whereHas($relationName, function ($q) use ($search, $fieldName) { |
|
| 203 | + $query->whereHas($relationName, function($q) use ($search, $fieldName) { |
|
| 204 | 204 | $this->buildQuery($q, $fieldName, $search); |
| 205 | 205 | }); |
| 206 | 206 | } |
@@ -208,7 +208,7 @@ discard block |
||
| 208 | 208 | |
| 209 | 209 | protected function loadOptions() |
| 210 | 210 | { |
| 211 | - $repository = app(RepositoryInterface::class, [$this->getModel()]); |
|
| 211 | + $repository = app(RepositoryInterface::class, [ $this->getModel() ]); |
|
| 212 | 212 | |
| 213 | 213 | $key = $repository->getModel()->getKeyName(); |
| 214 | 214 | $options = $repository->getQuery()->get()->lists($this->getDisplay(), $key); |
@@ -21,7 +21,7 @@ |
||
| 21 | 21 | { |
| 22 | 22 | parent::__construct($label); |
| 23 | 23 | $this->setLabel( |
| 24 | - Form::checkbox(null, 1, false, ['class' => 'adminCheckboxAll'] |
|
| 24 | + Form::checkbox(null, 1, false, [ 'class' => 'adminCheckboxAll' ] |
|
| 25 | 25 | )); |
| 26 | 26 | |
| 27 | 27 | $this->setOrderable(false); |