@@ -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 | } |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | */ |
| 145 | 145 | public function isActive() |
| 146 | 146 | { |
| 147 | - return ! is_null($this->getValue()); |
|
| 147 | + return !is_null($this->getValue()); |
|
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | /** |
@@ -162,8 +162,8 @@ discard block |
||
| 162 | 162 | $relationName = implode('.', $parts); |
| 163 | 163 | } |
| 164 | 164 | |
| 165 | - if (! is_null($relationName)) { |
|
| 166 | - $query->whereHas($relationName, function ($q) use ($name, $value) { |
|
| 165 | + if (!is_null($relationName)) { |
|
| 166 | + $query->whereHas($relationName, function($q) use ($name, $value) { |
|
| 167 | 167 | $this->buildQuery($q, $name, $value); |
| 168 | 168 | }); |
| 169 | 169 | } else { |
@@ -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 | |
@@ -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 |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | $this->repository = $this->makeRepository(); |
| 156 | 156 | $this->repository->with($this->with); |
| 157 | 157 | |
| 158 | - $this->extensions->each(function (DisplayExtensionInterface $extension) { |
|
| 158 | + $this->extensions->each(function(DisplayExtensionInterface $extension) { |
|
| 159 | 159 | if ($extension instanceof Initializable) { |
| 160 | 160 | $extension->initialize(); |
| 161 | 161 | } |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | if ($extension instanceof Placable) { |
| 164 | 164 | $template = app('sleeping_owl.template')->getViewPath($this->getView()); |
| 165 | 165 | |
| 166 | - view()->composer($template, function (\Illuminate\View\View $view) use ($extension) { |
|
| 166 | + view()->composer($template, function(\Illuminate\View\View $view) use ($extension) { |
|
| 167 | 167 | $view->getFactory()->inject( |
| 168 | 168 | $extension->getPlacement(), |
| 169 | 169 | app('sleeping_owl.template')->view($extension->getView(), $extension->toArray())->render() |
@@ -200,9 +200,9 @@ discard block |
||
| 200 | 200 | $this->title, |
| 201 | 201 | ]; |
| 202 | 202 | |
| 203 | - $this->getExtensions()->each(function (DisplayExtensionInterface $extension) use (&$titles) { |
|
| 203 | + $this->getExtensions()->each(function(DisplayExtensionInterface $extension) use (&$titles) { |
|
| 204 | 204 | if (method_exists($extension, $method = 'getTitle')) { |
| 205 | - $titles[] = call_user_func([$extension, $method]); |
|
| 205 | + $titles[ ] = call_user_func([ $extension, $method ]); |
|
| 206 | 206 | } |
| 207 | 207 | }); |
| 208 | 208 | |
@@ -277,7 +277,7 @@ discard block |
||
| 277 | 277 | $extension = $this->extensions->get($method); |
| 278 | 278 | |
| 279 | 279 | if (method_exists($extension, 'set')) { |
| 280 | - return call_user_func_array([$extension, 'set'], $arguments); |
|
| 280 | + return call_user_func_array([ $extension, 'set' ], $arguments); |
|
| 281 | 281 | } |
| 282 | 282 | } |
| 283 | 283 | |
@@ -297,6 +297,6 @@ discard block |
||
| 297 | 297 | */ |
| 298 | 298 | protected function makeRepository() |
| 299 | 299 | { |
| 300 | - return app($this->repositoryClass, [$this->modelClass]); |
|
| 300 | + return app($this->repositoryClass, [ $this->modelClass ]); |
|
| 301 | 301 | } |
| 302 | 302 | } |
@@ -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 | } |
@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | /** |
| 15 | 15 | * @var DisplayTab[] |
| 16 | 16 | */ |
| 17 | - protected $tabs = []; |
|
| 17 | + protected $tabs = [ ]; |
|
| 18 | 18 | |
| 19 | 19 | /** |
| 20 | 20 | * @var string |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | { |
| 80 | 80 | $tab = app('sleeping_owl.display')->tab($display)->setLabel($label)->setActive($active); |
| 81 | 81 | |
| 82 | - $this->tabs[] = $tab; |
|
| 82 | + $this->tabs[ ] = $tab; |
|
| 83 | 83 | |
| 84 | 84 | return $tab; |
| 85 | 85 | } |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | foreach ($this->getTabs() as $tab) { |
| 119 | 119 | if ($tab instanceof FormInterface) { |
| 120 | 120 | $result = $tab->validateForm($model); |
| 121 | - if (! is_null($result)) { |
|
| 121 | + if (!is_null($result)) { |
|
| 122 | 122 | return $result; |
| 123 | 123 | } |
| 124 | 124 | } |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | /** |
| 31 | 31 | * @var array |
| 32 | 32 | */ |
| 33 | - protected $parameters = []; |
|
| 33 | + protected $parameters = [ ]; |
|
| 34 | 34 | |
| 35 | 35 | /** |
| 36 | 36 | * @var int|null |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | parent::initialize(); |
| 67 | 67 | |
| 68 | 68 | if ($this->getModelConfiguration()->isRestorableModel()) { |
| 69 | - $this->setApply(function ($q) { |
|
| 69 | + $this->setApply(function($q) { |
|
| 70 | 70 | return $q->withTrashed(); |
| 71 | 71 | }); |
| 72 | 72 | } |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | */ |
| 103 | 103 | public function setParameter($key, $value) |
| 104 | 104 | { |
| 105 | - $this->parameters[$key] = $value; |
|
| 105 | + $this->parameters[ $key ] = $value; |
|
| 106 | 106 | |
| 107 | 107 | return $this; |
| 108 | 108 | } |
@@ -148,15 +148,15 @@ discard block |
||
| 148 | 148 | |
| 149 | 149 | $params = parent::toArray(); |
| 150 | 150 | |
| 151 | - $params['creatable'] = $model->isCreatable(); |
|
| 152 | - $params['createUrl'] = $model->getCreateUrl($this->getParameters() + Request::all()); |
|
| 153 | - $params['collection'] = $this->getCollection(); |
|
| 151 | + $params[ 'creatable' ] = $model->isCreatable(); |
|
| 152 | + $params[ 'createUrl' ] = $model->getCreateUrl($this->getParameters() + Request::all()); |
|
| 153 | + $params[ 'collection' ] = $this->getCollection(); |
|
| 154 | 154 | |
| 155 | - $params['extensions'] = $this->getExtensions() |
|
| 156 | - ->filter(function (DisplayExtensionInterface $ext) { |
|
| 155 | + $params[ 'extensions' ] = $this->getExtensions() |
|
| 156 | + ->filter(function(DisplayExtensionInterface $ext) { |
|
| 157 | 157 | return $ext instanceof Renderable; |
| 158 | 158 | }) |
| 159 | - ->sortBy(function (DisplayExtensionInterface $extension) { |
|
| 159 | + ->sortBy(function(DisplayExtensionInterface $extension) { |
|
| 160 | 160 | return $extension->getOrder(); |
| 161 | 161 | }); |
| 162 | 162 | |
@@ -179,11 +179,11 @@ discard block |
||
| 179 | 179 | */ |
| 180 | 180 | public function getCollection() |
| 181 | 181 | { |
| 182 | - if (! $this->isInitialized()) { |
|
| 182 | + if (!$this->isInitialized()) { |
|
| 183 | 183 | throw new \Exception('Display is not initialized'); |
| 184 | 184 | } |
| 185 | 185 | |
| 186 | - if (! is_null($this->collection)) { |
|
| 186 | + if (!is_null($this->collection)) { |
|
| 187 | 187 | return $this->collection; |
| 188 | 188 | } |
| 189 | 189 | |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | $this->modifyQuery($query); |
| 193 | 193 | |
| 194 | 194 | return $this->collection = $this->usePagination() |
| 195 | - ? $query->paginate($this->paginate, ['*'], $this->pageName) |
|
| 195 | + ? $query->paginate($this->paginate, [ '*' ], $this->pageName) |
|
| 196 | 196 | : $query->get(); |
| 197 | 197 | } |
| 198 | 198 | |
@@ -201,7 +201,7 @@ discard block |
||
| 201 | 201 | */ |
| 202 | 202 | protected function modifyQuery(\Illuminate\Database\Eloquent\Builder $query) |
| 203 | 203 | { |
| 204 | - $this->extensions->each(function (DisplayExtensionInterface $extension) use ($query) { |
|
| 204 | + $this->extensions->each(function(DisplayExtensionInterface $extension) use ($query) { |
|
| 205 | 205 | $extension->modifyQuery($query); |
| 206 | 206 | }); |
| 207 | 207 | } |
@@ -18,8 +18,8 @@ discard block |
||
| 18 | 18 | */ |
| 19 | 19 | public static function registerRoutes() |
| 20 | 20 | { |
| 21 | - Route::get('{adminModel}/async/{adminDisplayName?}', ['as' => 'admin.model.async', |
|
| 22 | - function (ModelConfigurationInterface $model, $name = null) { |
|
| 21 | + Route::get('{adminModel}/async/{adminDisplayName?}', [ 'as' => 'admin.model.async', |
|
| 22 | + function(ModelConfigurationInterface $model, $name = null) { |
|
| 23 | 23 | $display = $model->fireDisplay(); |
| 24 | 24 | if ($display instanceof DisplayTabbed) { |
| 25 | 25 | $display = static::findDatatablesAsyncByName($display, $name); |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | $totalCount = $query->count(); |
| 144 | 144 | $filteredCount = 0; |
| 145 | 145 | |
| 146 | - if (! is_null($this->distinct)) { |
|
| 146 | + if (!is_null($this->distinct)) { |
|
| 147 | 147 | $filteredCount = $query->distinct()->count($this->getDistinct()); |
| 148 | 148 | } |
| 149 | 149 | |
@@ -186,11 +186,11 @@ discard block |
||
| 186 | 186 | */ |
| 187 | 187 | protected function applyOrders($query) |
| 188 | 188 | { |
| 189 | - $orders = Request::input('order', []); |
|
| 189 | + $orders = Request::input('order', [ ]); |
|
| 190 | 190 | |
| 191 | 191 | foreach ($orders as $order) { |
| 192 | - $columnIndex = $order['column']; |
|
| 193 | - $orderDirection = $order['dir']; |
|
| 192 | + $columnIndex = $order[ 'column' ]; |
|
| 193 | + $orderDirection = $order[ 'dir' ]; |
|
| 194 | 194 | $column = $this->getColumns()->all()->get($columnIndex); |
| 195 | 195 | |
| 196 | 196 | if ($column instanceof NamedColumn && $column->isOrderable()) { |
@@ -212,7 +212,7 @@ discard block |
||
| 212 | 212 | return; |
| 213 | 213 | } |
| 214 | 214 | |
| 215 | - $query->where(function ($query) use ($search) { |
|
| 215 | + $query->where(function($query) use ($search) { |
|
| 216 | 216 | $columns = $this->getColumns()->all(); |
| 217 | 217 | foreach ($columns as $column) { |
| 218 | 218 | if ($column instanceof Text) { |
@@ -230,7 +230,7 @@ discard block |
||
| 230 | 230 | */ |
| 231 | 231 | protected function applyColumnSearch(Builder $query) |
| 232 | 232 | { |
| 233 | - $queryColumns = Request::input('columns', []); |
|
| 233 | + $queryColumns = Request::input('columns', [ ]); |
|
| 234 | 234 | |
| 235 | 235 | foreach ($queryColumns as $index => $queryColumn) { |
| 236 | 236 | $search = array_get($queryColumn, 'search.value'); |
@@ -238,7 +238,7 @@ discard block |
||
| 238 | 238 | $column = $this->getColumns()->all()->get($index); |
| 239 | 239 | $columnFilter = array_get($this->getColumnFilters()->all(), $index); |
| 240 | 240 | |
| 241 | - if (! is_null($columnFilter) && ! is_null($column)) { |
|
| 241 | + if (!is_null($columnFilter) && !is_null($column)) { |
|
| 242 | 242 | $columnFilter->apply($this->repository, $column, $query, $search, $fullSearch); |
| 243 | 243 | } |
| 244 | 244 | } |
@@ -257,21 +257,21 @@ discard block |
||
| 257 | 257 | { |
| 258 | 258 | $columns = $this->getColumns(); |
| 259 | 259 | |
| 260 | - $result = []; |
|
| 261 | - $result['draw'] = Request::input('draw', 0); |
|
| 262 | - $result['recordsTotal'] = $totalCount; |
|
| 263 | - $result['recordsFiltered'] = $filteredCount; |
|
| 264 | - $result['data'] = []; |
|
| 260 | + $result = [ ]; |
|
| 261 | + $result[ 'draw' ] = Request::input('draw', 0); |
|
| 262 | + $result[ 'recordsTotal' ] = $totalCount; |
|
| 263 | + $result[ 'recordsFiltered' ] = $filteredCount; |
|
| 264 | + $result[ 'data' ] = [ ]; |
|
| 265 | 265 | |
| 266 | 266 | foreach ($collection as $instance) { |
| 267 | - $_row = []; |
|
| 267 | + $_row = [ ]; |
|
| 268 | 268 | |
| 269 | 269 | foreach ($columns->all() as $column) { |
| 270 | 270 | $column->setModel($instance); |
| 271 | - $_row[] = (string) $column; |
|
| 271 | + $_row[ ] = (string) $column; |
|
| 272 | 272 | } |
| 273 | 273 | |
| 274 | - $result['data'][] = $_row; |
|
| 274 | + $result[ 'data' ][ ] = $_row; |
|
| 275 | 275 | } |
| 276 | 276 | |
| 277 | 277 | return $result; |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | { |
| 56 | 56 | $this->header = app(TableHeaderColumnInterface::class); |
| 57 | 57 | |
| 58 | - if (! is_null($label)) { |
|
| 58 | + if (!is_null($label)) { |
|
| 59 | 59 | $this->setLabel($label); |
| 60 | 60 | } |
| 61 | 61 | } |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | $this->model = $model; |
| 160 | 160 | $append = $this->getAppends(); |
| 161 | 161 | |
| 162 | - if (! is_null($append)) { |
|
| 162 | + if (!is_null($append)) { |
|
| 163 | 163 | $append->setModel($model); |
| 164 | 164 | } |
| 165 | 165 | |