@@ -25,6 +25,9 @@ |
||
25 | 25 | $this->formGenerator = $formGenerator; |
26 | 26 | } |
27 | 27 | |
28 | + /** |
|
29 | + * @param string $methodName |
|
30 | + */ |
|
28 | 31 | private function authorizeMethod(Model $modelAbstractor, $methodName) |
29 | 32 | { |
30 | 33 | if (array_key_exists('authorize', $config = $modelAbstractor->getConfig()) && $config['authorize'] === true) { |
@@ -38,8 +38,8 @@ discard block |
||
38 | 38 | */ |
39 | 39 | private function customController(Model $modelAbstractor) |
40 | 40 | { |
41 | - if (! $this instanceof CustomController) { //Avoid infinite recursion |
|
42 | - if (array_key_exists('controller', $config = $modelAbstractor->getConfig()) && (! empty($config['controller']))) { |
|
41 | + if (!$this instanceof CustomController) { //Avoid infinite recursion |
|
42 | + if (array_key_exists('controller', $config = $modelAbstractor->getConfig()) && (!empty($config['controller']))) { |
|
43 | 43 | /** @var CustomController $controller */ |
44 | 44 | $controller = App::make($config['controller']); |
45 | 45 | $controller->setAbstractor($modelAbstractor); |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | |
63 | 63 | $this->authorizeMethod($modelAbstractor, 'adminIndex'); |
64 | 64 | |
65 | - if (! empty($customController = $this->customController($modelAbstractor))) { |
|
65 | + if (!empty($customController = $this->customController($modelAbstractor))) { |
|
66 | 66 | return $customController->index($request, $model); |
67 | 67 | } |
68 | 68 | |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | |
103 | 103 | $this->authorizeMethod($modelAbstractor, 'adminCreate'); |
104 | 104 | |
105 | - if (! empty($customController = $this->customController($modelAbstractor))) { |
|
105 | + if (!empty($customController = $this->customController($modelAbstractor))) { |
|
106 | 106 | return $customController->create($model); |
107 | 107 | } |
108 | 108 | |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | |
129 | 129 | $this->authorizeMethod($modelAbstractor, 'adminStore'); |
130 | 130 | |
131 | - if (! empty($customController = $this->customController($modelAbstractor))) { |
|
131 | + if (!empty($customController = $this->customController($modelAbstractor))) { |
|
132 | 132 | return $customController->store($request, $model); |
133 | 133 | } |
134 | 134 | |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | |
163 | 163 | $this->authorizeMethod($modelAbstractor, 'adminShow'); |
164 | 164 | |
165 | - if (! empty($customController = $this->customController($modelAbstractor))) { |
|
165 | + if (!empty($customController = $this->customController($modelAbstractor))) { |
|
166 | 166 | return $customController->show($model, $id); |
167 | 167 | } |
168 | 168 | |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | |
190 | 190 | $this->authorizeMethod($modelAbstractor, 'adminEdit'); |
191 | 191 | |
192 | - if (! empty($customController = $this->customController($modelAbstractor))) { |
|
192 | + if (!empty($customController = $this->customController($modelAbstractor))) { |
|
193 | 193 | return $customController->edit($model, $id); |
194 | 194 | } |
195 | 195 | |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | |
220 | 220 | $this->authorizeMethod($modelAbstractor, 'adminUpdate'); |
221 | 221 | |
222 | - if (! empty($customController = $this->customController($modelAbstractor))) { |
|
222 | + if (!empty($customController = $this->customController($modelAbstractor))) { |
|
223 | 223 | return $customController->update($request, $model, $id); |
224 | 224 | } |
225 | 225 | |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | |
255 | 255 | $this->authorizeMethod($modelAbstractor, 'adminDestroy'); |
256 | 256 | |
257 | - if (! empty($customController = $this->customController($modelAbstractor))) { |
|
257 | + if (!empty($customController = $this->customController($modelAbstractor))) { |
|
258 | 258 | return $customController->destroy($request, $model, $id); |
259 | 259 | } |
260 | 260 |
@@ -23,7 +23,7 @@ |
||
23 | 23 | $modelAbstractor = $modelFactory->getByName($modelSlug); |
24 | 24 | $config = $modelAbstractor->getConfig(); |
25 | 25 | |
26 | - if (! array_key_exists('authorize', $config) || ( $config['authorize'] === true && Gate::allows('adminIndex', $modelAbstractor->getInstance()))) { |
|
26 | + if (!array_key_exists('authorize', $config) || ($config['authorize'] === true && Gate::allows('adminIndex', $modelAbstractor->getInstance()))) { |
|
27 | 27 | return new RedirectResponse(route('anavel-crud.model.index', $modelSlug)); |
28 | 28 | } |
29 | 29 |
@@ -41,11 +41,11 @@ |
||
41 | 41 | $columnRelation = explode('.', $column); |
42 | 42 | |
43 | 43 | if ($or) { |
44 | - $query->orWhereHas($columnRelation[0], function ($subquery) use ($columnRelation) { |
|
44 | + $query->orWhereHas($columnRelation[0], function($subquery) use ($columnRelation) { |
|
45 | 45 | $subquery->where($columnRelation[1], 'LIKE', '%'.$this->queryString.'%'); |
46 | 46 | }); |
47 | 47 | } else { |
48 | - $query->whereHas($columnRelation[0], function ($subquery) use ($columnRelation) { |
|
48 | + $query->whereHas($columnRelation[0], function($subquery) use ($columnRelation) { |
|
49 | 49 | $subquery->where($columnRelation[1], 'LIKE', '%'.$this->queryString.'%'); |
50 | 50 | }); |
51 | 51 | } |