@@ -2,11 +2,11 @@ |
||
| 2 | 2 | |
| 3 | 3 | namespace Eliurkis\Crud; |
| 4 | 4 | |
| 5 | -use DB; |
|
| 6 | -use Illuminate\Http\Request; |
|
| 7 | 5 | use App\Http\Controllers\Controller; |
| 8 | -use Illuminate\Database\QueryException; |
|
| 6 | +use DB; |
|
| 9 | 7 | use Illuminate\Database\Eloquent\Builder; |
| 8 | +use Illuminate\Database\QueryException; |
|
| 9 | +use Illuminate\Http\Request; |
|
| 10 | 10 | |
| 11 | 11 | class CrudController extends Controller |
| 12 | 12 | { |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | { |
| 45 | 45 | $this->entity = $entity; |
| 46 | 46 | |
| 47 | - $config = count($config) ? $config : config('crud.' . $this->route); |
|
| 47 | + $config = count($config) ? $config : config('crud.'.$this->route); |
|
| 48 | 48 | |
| 49 | 49 | foreach ($config as $key => $value) { |
| 50 | 50 | $this->$key = $value; |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | |
| 126 | 126 | public function edit($id) |
| 127 | 127 | { |
| 128 | - if (! $this->entityInstance) { |
|
| 128 | + if (!$this->entityInstance) { |
|
| 129 | 129 | $this->entityInstance = $this->entity->findOrFail($id); |
| 130 | 130 | } |
| 131 | 131 | |
@@ -269,7 +269,7 @@ discard block |
||
| 269 | 269 | if ($request->get('q') != '') { |
| 270 | 270 | $searchableCols = isset($this->searchable['columns']) ? $this->searchable['columns'] : $this->searchable; |
| 271 | 271 | |
| 272 | - $entity = $entity->where(function (Builder $query) use ($request, $searchableCols) { |
|
| 272 | + $entity = $entity->where(function(Builder $query) use ($request, $searchableCols) { |
|
| 273 | 273 | foreach ($searchableCols as $field) { |
| 274 | 274 | $query->orWhere($field, 'like', '%'.$request->get('q').'%'); |
| 275 | 275 | } |
@@ -343,7 +343,7 @@ discard block |
||
| 343 | 343 | $links = ['index', 'create', 'store']; |
| 344 | 344 | |
| 345 | 345 | foreach ($links as $link) { |
| 346 | - if (! isset($this->links[$link])) { |
|
| 346 | + if (!isset($this->links[$link])) { |
|
| 347 | 347 | $this->links[$link] = route($this->route.'.'.$link); |
| 348 | 348 | } |
| 349 | 349 | } |
@@ -387,7 +387,7 @@ discard block |
||
| 387 | 387 | $config['cols'] = isset($config['cols']) ? $config['cols'] : 1; |
| 388 | 388 | |
| 389 | 389 | // Get foreign values |
| 390 | - if (! count($config['options']) && isset($config['entity'])) { |
|
| 390 | + if (!count($config['options']) && isset($config['entity'])) { |
|
| 391 | 391 | $config['options'] = $config['entity']::get() |
| 392 | 392 | ->lists($config['field_value'], $config['field_key']) |
| 393 | 393 | ->toArray(); |
@@ -419,7 +419,7 @@ discard block |
||
| 419 | 419 | protected function prepareField($name, $properties = []) |
| 420 | 420 | { |
| 421 | 421 | // Init |
| 422 | - if (! $properties) { |
|
| 422 | + if (!$properties) { |
|
| 423 | 423 | $properties = $this->fields[$name]; |
| 424 | 424 | } |
| 425 | 425 | |
@@ -436,7 +436,7 @@ discard block |
||
| 436 | 436 | |
| 437 | 437 | // Define field type class namespace |
| 438 | 438 | $className = '\Eliurkis\Crud\FieldTypes\\'.ucfirst($properties['type']); |
| 439 | - if (! class_exists($className)) { |
|
| 439 | + if (!class_exists($className)) { |
|
| 440 | 440 | return; |
| 441 | 441 | } |
| 442 | 442 | |