@@ -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 | |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | |
| 21 | 21 | public static function registerRoutes() |
| 22 | 22 | { |
| 23 | - Route::post('{adminModel}/reorder', function (ModelConfigurationInterface $model) { |
|
| 23 | + Route::post('{adminModel}/reorder', function(ModelConfigurationInterface $model) { |
|
| 24 | 24 | $model->fireDisplay()->getRepository()->reorder( |
| 25 | 25 | Request::input('data') |
| 26 | 26 | ); |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | /** |
| 36 | 36 | * @var array |
| 37 | 37 | */ |
| 38 | - protected $parameters = []; |
|
| 38 | + protected $parameters = [ ]; |
|
| 39 | 39 | |
| 40 | 40 | /** |
| 41 | 41 | * @var bool |
@@ -202,7 +202,7 @@ discard block |
||
| 202 | 202 | */ |
| 203 | 203 | public function setParameter($key, $value) |
| 204 | 204 | { |
| 205 | - $this->parameters[$key] = $value; |
|
| 205 | + $this->parameters[ $key ] = $value; |
|
| 206 | 206 | |
| 207 | 207 | return $this; |
| 208 | 208 | } |
@@ -249,7 +249,7 @@ discard block |
||
| 249 | 249 | 'value' => $this->getValue(), |
| 250 | 250 | 'creatable' => $model->isCreatable(), |
| 251 | 251 | 'createUrl' => $model->getCreateUrl($this->getParameters() + Request::all()), |
| 252 | - 'controls' => [app('sleeping_owl.table.column')->treeControl()], |
|
| 252 | + 'controls' => [ app('sleeping_owl.table.column')->treeControl() ], |
|
| 253 | 253 | ]; |
| 254 | 254 | } |
| 255 | 255 | |
@@ -267,11 +267,11 @@ discard block |
||
| 267 | 267 | */ |
| 268 | 268 | public function getCollection() |
| 269 | 269 | { |
| 270 | - if (! $this->isInitialized()) { |
|
| 270 | + if (!$this->isInitialized()) { |
|
| 271 | 271 | throw new \Exception('Display is not initialized'); |
| 272 | 272 | } |
| 273 | 273 | |
| 274 | - if (! is_null($this->collection)) { |
|
| 274 | + if (!is_null($this->collection)) { |
|
| 275 | 275 | return $this->collection; |
| 276 | 276 | } |
| 277 | 277 | |
@@ -287,7 +287,7 @@ discard block |
||
| 287 | 287 | */ |
| 288 | 288 | protected function modifyQuery(\Illuminate\Database\Eloquent\Builder $query) |
| 289 | 289 | { |
| 290 | - $this->extensions->each(function (DisplayExtensionInterface $extension) use ($query) { |
|
| 290 | + $this->extensions->each(function(DisplayExtensionInterface $extension) use ($query) { |
|
| 291 | 291 | $extension->modifyQuery($query); |
| 292 | 292 | }); |
| 293 | 293 | } |
@@ -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 | } |
@@ -189,7 +189,7 @@ |
||
| 189 | 189 | $fieldName = array_pop($parts); |
| 190 | 190 | $relationName = implode('.', $parts); |
| 191 | 191 | |
| 192 | - $query->whereHas($relationName, function ($q) use ($name, $time) { |
|
| 192 | + $query->whereHas($relationName, function($q) use ($name, $time) { |
|
| 193 | 193 | $this->buildQuery($q, $name, $time); |
| 194 | 194 | }); |
| 195 | 195 | } |
@@ -106,14 +106,14 @@ |
||
| 106 | 106 | $from = array_get($fullSearch, 'from'); |
| 107 | 107 | $to = array_get($fullSearch, 'to'); |
| 108 | 108 | |
| 109 | - if (! empty($from)) { |
|
| 109 | + if (!empty($from)) { |
|
| 110 | 110 | $this |
| 111 | 111 | ->getFrom() |
| 112 | 112 | ->setOperator(FilterInterface::LESS_OR_EQUAL) |
| 113 | 113 | ->apply($repository, $column, $query, $from, $fullSearch); |
| 114 | 114 | } |
| 115 | 115 | |
| 116 | - if (! empty($to)) { |
|
| 116 | + if (!empty($to)) { |
|
| 117 | 117 | $this |
| 118 | 118 | ->getTo() |
| 119 | 119 | ->setOperator(FilterInterface::LESS_OR_EQUAL) |
@@ -40,7 +40,7 @@ |
||
| 40 | 40 | */ |
| 41 | 41 | public function toArray() |
| 42 | 42 | { |
| 43 | - return []; |
|
| 43 | + return [ ]; |
|
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | /** |
@@ -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); |