We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | |
| 30 | 30 | public function tabsDisabled() |
| 31 | 31 | { |
| 32 | - return ! $this->tabsEnabled; |
|
| 32 | + return !$this->tabsEnabled; |
|
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | public function setTabsType($type) |
@@ -91,8 +91,8 @@ discard block |
||
| 91 | 91 | { |
| 92 | 92 | $all_fields = $this->getCurrentFields(); |
| 93 | 93 | |
| 94 | - $fields_without_a_tab = collect($all_fields)->filter(function ($value, $key) { |
|
| 95 | - return ! isset($value['tab']); |
|
| 94 | + $fields_without_a_tab = collect($all_fields)->filter(function($value, $key) { |
|
| 95 | + return !isset($value['tab']); |
|
| 96 | 96 | }); |
| 97 | 97 | |
| 98 | 98 | return $fields_without_a_tab; |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | if ($this->tabExists($label)) { |
| 104 | 104 | $all_fields = $this->getCurrentFields(); |
| 105 | 105 | |
| 106 | - $fields_for_current_tab = collect($all_fields)->filter(function ($value, $key) use ($label) { |
|
| 106 | + $fields_for_current_tab = collect($all_fields)->filter(function($value, $key) use ($label) { |
|
| 107 | 107 | return isset($value['tab']) && $value['tab'] == $label; |
| 108 | 108 | }); |
| 109 | 109 | |
@@ -119,11 +119,11 @@ discard block |
||
| 119 | 119 | $fields = $this->getCurrentFields(); |
| 120 | 120 | |
| 121 | 121 | $fields_with_tabs = collect($fields) |
| 122 | - ->filter(function ($value, $key) { |
|
| 122 | + ->filter(function($value, $key) { |
|
| 123 | 123 | return isset($value['tab']); |
| 124 | 124 | }) |
| 125 | - ->each(function ($value, $key) use (&$tabs) { |
|
| 126 | - if (! in_array($value['tab'], $tabs)) { |
|
| 125 | + ->each(function($value, $key) use (&$tabs) { |
|
| 126 | + if (!in_array($value['tab'], $tabs)) { |
|
| 127 | 127 | $tabs[] = $value['tab']; |
| 128 | 128 | } |
| 129 | 129 | }); |
@@ -22,6 +22,9 @@ |
||
| 22 | 22 | return $this->tabsEnabled; |
| 23 | 23 | } |
| 24 | 24 | |
| 25 | + /** |
|
| 26 | + * @return boolean |
|
| 27 | + */ |
|
| 25 | 28 | public function tabsEnabled() |
| 26 | 29 | { |
| 27 | 30 | return $this->tabsEnabled; |
@@ -65,7 +65,7 @@ |
||
| 65 | 65 | 'delete_confirmation_not_deleted_title' => 'Não apagado', |
| 66 | 66 | 'delete_confirmation_not_deleted_message' => 'Está tudo bem!. O item não foi apagado.', |
| 67 | 67 | |
| 68 | - // DataTables translation |
|
| 68 | + // DataTables translation |
|
| 69 | 69 | 'emptyTable' => 'Sem dados disponíveis na tabela', |
| 70 | 70 | 'info' => 'A mostrar _START_ a _END_ de _TOTAL_ registos', |
| 71 | 71 | 'infoEmpty' => 'A mostrar 0 a 0 de 0 registos', |
@@ -24,19 +24,19 @@ |
||
| 24 | 24 | if (isset($field['fake']) && $field['fake'] == true) { |
| 25 | 25 | // add it to the request in its appropriate variable - the one defined, if defined |
| 26 | 26 | if (isset($field['store_in'])) { |
| 27 | - if (! in_array($field['store_in'], $fakeFieldsColumnsArray, true)) { |
|
| 27 | + if (!in_array($field['store_in'], $fakeFieldsColumnsArray, true)) { |
|
| 28 | 28 | array_push($fakeFieldsColumnsArray, $field['store_in']); |
| 29 | 29 | } |
| 30 | 30 | } else { |
| 31 | 31 | //otherwise in the one defined in the $crud variable |
| 32 | - if (! in_array('extras', $fakeFieldsColumnsArray, true)) { |
|
| 32 | + if (!in_array('extras', $fakeFieldsColumnsArray, true)) { |
|
| 33 | 33 | array_push($fakeFieldsColumnsArray, 'extras'); |
| 34 | 34 | } |
| 35 | 35 | } |
| 36 | 36 | } |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | - if (! count($fakeFieldsColumnsArray)) { |
|
| 39 | + if (!count($fakeFieldsColumnsArray)) { |
|
| 40 | 40 | $fakeFieldsColumnsArray = ['extras']; |
| 41 | 41 | } |
| 42 | 42 | |
@@ -9,7 +9,7 @@ |
||
| 9 | 9 | * been found. |
| 10 | 10 | * |
| 11 | 11 | * @param string $form The CRUD form. Can be 'create', 'update' or 'both'. Default is 'create'. |
| 12 | - * @param int|bool $id Optional entity ID needed in the case of the update form. |
|
| 12 | + * @param integer $id Optional entity ID needed in the case of the update form. |
|
| 13 | 13 | * @return array The fake columns array. |
| 14 | 14 | */ |
| 15 | 15 | public function getFakeColumnsAsArray($form = 'create', $id = false) |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | */ |
| 34 | 34 | public function hasAccess($permission) |
| 35 | 35 | { |
| 36 | - if (! in_array($permission, $this->access)) { |
|
| 36 | + if (!in_array($permission, $this->access)) { |
|
| 37 | 37 | return false; |
| 38 | 38 | } |
| 39 | 39 | |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | public function hasAccessToAll($permission_array) |
| 69 | 69 | { |
| 70 | 70 | foreach ($permission_array as $key => $permission) { |
| 71 | - if (! in_array($permission, $this->access)) { |
|
| 71 | + if (!in_array($permission, $this->access)) { |
|
| 72 | 72 | return false; |
| 73 | 73 | } |
| 74 | 74 | } |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | */ |
| 87 | 87 | public function hasAccessOrFail($permission) |
| 88 | 88 | { |
| 89 | - if (! in_array($permission, $this->access)) { |
|
| 89 | + if (!in_array($permission, $this->access)) { |
|
| 90 | 90 | throw new AccessDeniedException(trans('backpack::crud.unauthorized_access')); |
| 91 | 91 | } |
| 92 | 92 | |
@@ -12,12 +12,18 @@ |
||
| 12 | 12 | |-------------------------------------------------------------------------- |
| 13 | 13 | */ |
| 14 | 14 | |
| 15 | + /** |
|
| 16 | + * @param string $access |
|
| 17 | + */ |
|
| 15 | 18 | public function allowAccess($access) |
| 16 | 19 | { |
| 17 | 20 | // $this->addButtons((array)$access); |
| 18 | 21 | return $this->access = array_merge(array_diff((array) $access, $this->access), $this->access); |
| 19 | 22 | } |
| 20 | 23 | |
| 24 | + /** |
|
| 25 | + * @param string $access |
|
| 26 | + */ |
|
| 21 | 27 | public function denyAccess($access) |
| 22 | 28 | { |
| 23 | 29 | // $this->removeButtons((array)$access); |
@@ -15,7 +15,7 @@ |
||
| 15 | 15 | * |
| 16 | 16 | * @param int $id The id of the item to be deleted. |
| 17 | 17 | * |
| 18 | - * @return bool True if the item was deleted. |
|
| 18 | + * @return string True if the item was deleted. |
|
| 19 | 19 | * |
| 20 | 20 | * @throws \Illuminate\Database\Eloquent\ModelNotFoundException if the model was not found. |
| 21 | 21 | * |
@@ -123,6 +123,7 @@ |
||
| 123 | 123 | * |
| 124 | 124 | * @param [string] Route name. |
| 125 | 125 | * @param [array] Parameters. |
| 126 | + * @param string $route |
|
| 126 | 127 | */ |
| 127 | 128 | public function setRouteName($route, $parameters = []) |
| 128 | 129 | { |
@@ -2,27 +2,27 @@ |
||
| 2 | 2 | |
| 3 | 3 | namespace Backpack\CRUD; |
| 4 | 4 | |
| 5 | -use Backpack\CRUD\PanelTraits\Read; |
|
| 6 | -use Backpack\CRUD\PanelTraits\Tabs; |
|
| 5 | +use Backedin\BackpackTraits\Backpack\Buttons; |
|
| 7 | 6 | use Backedin\BackpackTraits\Backpack\Query; |
| 8 | -use Backpack\CRUD\PanelTraits\Views; |
|
| 9 | 7 | use Backpack\CRUD\PanelTraits\Access; |
| 8 | +use Backpack\CRUD\PanelTraits\AutoFocus; |
|
| 9 | +use Backpack\CRUD\PanelTraits\AutoSet; |
|
| 10 | +use Backpack\CRUD\PanelTraits\Columns; |
|
| 10 | 11 | use Backpack\CRUD\PanelTraits\Create; |
| 11 | 12 | use Backpack\CRUD\PanelTraits\Delete; |
| 12 | 13 | use Backpack\CRUD\PanelTraits\Errors; |
| 14 | +use Backpack\CRUD\PanelTraits\FakeColumns; |
|
| 15 | +use Backpack\CRUD\PanelTraits\FakeFields; |
|
| 13 | 16 | use Backpack\CRUD\PanelTraits\Fields; |
| 14 | -use Backpack\CRUD\PanelTraits\Search; |
|
| 15 | -use Backpack\CRUD\PanelTraits\Update; |
|
| 16 | -use Backpack\CRUD\PanelTraits\AutoSet; |
|
| 17 | -use Backedin\BackpackTraits\Backpack\Buttons; |
|
| 18 | -use Backpack\CRUD\PanelTraits\Columns; |
|
| 19 | 17 | use Backpack\CRUD\PanelTraits\Filters; |
| 18 | +use Backpack\CRUD\PanelTraits\Read; |
|
| 20 | 19 | use Backpack\CRUD\PanelTraits\Reorder; |
| 21 | -use Backpack\CRUD\PanelTraits\AutoFocus; |
|
| 22 | -use Backpack\CRUD\PanelTraits\FakeFields; |
|
| 23 | -use Backpack\CRUD\PanelTraits\FakeColumns; |
|
| 24 | -use Illuminate\Database\Eloquent\Collection; |
|
| 20 | +use Backpack\CRUD\PanelTraits\Search; |
|
| 21 | +use Backpack\CRUD\PanelTraits\Tabs; |
|
| 22 | +use Backpack\CRUD\PanelTraits\Update; |
|
| 23 | +use Backpack\CRUD\PanelTraits\Views; |
|
| 25 | 24 | use Backpack\CRUD\PanelTraits\ViewsAndRestoresRevisions; |
| 25 | +use Illuminate\Database\Eloquent\Collection; |
|
| 26 | 26 | |
| 27 | 27 | class CrudPanel |
| 28 | 28 | { |
@@ -268,26 +268,26 @@ |
||
| 268 | 268 | */ |
| 269 | 269 | public function getRelationModel($relationString, $length = null, $model = null) |
| 270 | 270 | { |
| 271 | - if(!$model = $this->model->find($this->getLastParameter())) |
|
| 272 | - { |
|
| 273 | - $model = $this->model; |
|
| 274 | - } |
|
| 271 | + if(!$model = $this->model->find($this->getLastParameter())) |
|
| 272 | + { |
|
| 273 | + $model = $this->model; |
|
| 274 | + } |
|
| 275 | 275 | |
| 276 | - $relationArray = explode('.', $relationString); |
|
| 276 | + $relationArray = explode('.', $relationString); |
|
| 277 | 277 | |
| 278 | - if (! isset($length)) { |
|
| 279 | - $length = count($relationArray); |
|
| 280 | - } |
|
| 278 | + if (! isset($length)) { |
|
| 279 | + $length = count($relationArray); |
|
| 280 | + } |
|
| 281 | 281 | |
| 282 | - if (! isset($model)) { |
|
| 283 | - $model = $this->model; |
|
| 284 | - } |
|
| 282 | + if (! isset($model)) { |
|
| 283 | + $model = $this->model; |
|
| 284 | + } |
|
| 285 | 285 | |
| 286 | - $result = array_reduce(array_splice($relationArray, 0, $length), function ($obj, $method) { |
|
| 287 | - return $obj->$method()->getRelated(); |
|
| 288 | - }, $model); |
|
| 286 | + $result = array_reduce(array_splice($relationArray, 0, $length), function ($obj, $method) { |
|
| 287 | + return $obj->$method()->getRelated(); |
|
| 288 | + }, $model); |
|
| 289 | 289 | |
| 290 | - return get_class($result); |
|
| 290 | + return get_class($result); |
|
| 291 | 291 | } |
| 292 | 292 | |
| 293 | 293 | /** |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | */ |
| 91 | 91 | public function setModel($model_namespace) |
| 92 | 92 | { |
| 93 | - if (! class_exists($model_namespace)) { |
|
| 93 | + if (!class_exists($model_namespace)) { |
|
| 94 | 94 | throw new \Exception('This model does not exist.', 404); |
| 95 | 95 | } |
| 96 | 96 | |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | { |
| 141 | 141 | $complete_route = $route.'.index'; |
| 142 | 142 | |
| 143 | - if (! \Route::has($complete_route)) { |
|
| 143 | + if (!\Route::has($complete_route)) { |
|
| 144 | 144 | throw new \Exception('There are no routes for this route name.', 404); |
| 145 | 145 | } |
| 146 | 146 | |
@@ -190,7 +190,7 @@ discard block |
||
| 190 | 190 | */ |
| 191 | 191 | public function getFirstOfItsTypeInArray($type, $array) |
| 192 | 192 | { |
| 193 | - return array_first($array, function ($item) use ($type) { |
|
| 193 | + return array_first($array, function($item) use ($type) { |
|
| 194 | 194 | return $item['type'] == $type; |
| 195 | 195 | }); |
| 196 | 196 | } |
@@ -207,8 +207,8 @@ discard block |
||
| 207 | 207 | |
| 208 | 208 | public function sync($type, $fields, $attributes) |
| 209 | 209 | { |
| 210 | - if (! empty($this->{$type})) { |
|
| 211 | - $this->{$type} = array_map(function ($field) use ($fields, $attributes) { |
|
| 210 | + if (!empty($this->{$type})) { |
|
| 211 | + $this->{$type} = array_map(function($field) use ($fields, $attributes) { |
|
| 212 | 212 | if (in_array($field['name'], (array) $fields)) { |
| 213 | 213 | $field = array_merge($field, $attributes); |
| 214 | 214 | } |
@@ -240,8 +240,8 @@ discard block |
||
| 240 | 240 | } |
| 241 | 241 | } |
| 242 | 242 | |
| 243 | - return $this->{$items} = array_merge($elements, array_filter($this->{$items}, function ($item) use ($items) { |
|
| 244 | - return ! in_array($item['name'], $this->sort[$items]); |
|
| 243 | + return $this->{$items} = array_merge($elements, array_filter($this->{$items}, function($item) use ($items) { |
|
| 244 | + return !in_array($item['name'], $this->sort[$items]); |
|
| 245 | 245 | })); |
| 246 | 246 | } |
| 247 | 247 | |
@@ -268,22 +268,22 @@ discard block |
||
| 268 | 268 | */ |
| 269 | 269 | public function getRelationModel($relationString, $length = null, $model = null) |
| 270 | 270 | { |
| 271 | - if(!$model = $this->model->find($this->getLastParameter())) |
|
| 271 | + if (!$model = $this->model->find($this->getLastParameter())) |
|
| 272 | 272 | { |
| 273 | 273 | $model = $this->model; |
| 274 | 274 | } |
| 275 | 275 | |
| 276 | 276 | $relationArray = explode('.', $relationString); |
| 277 | 277 | |
| 278 | - if (! isset($length)) { |
|
| 278 | + if (!isset($length)) { |
|
| 279 | 279 | $length = count($relationArray); |
| 280 | 280 | } |
| 281 | 281 | |
| 282 | - if (! isset($model)) { |
|
| 282 | + if (!isset($model)) { |
|
| 283 | 283 | $model = $this->model; |
| 284 | 284 | } |
| 285 | 285 | |
| 286 | - $result = array_reduce(array_splice($relationArray, 0, $length), function ($obj, $method) { |
|
| 286 | + $result = array_reduce(array_splice($relationArray, 0, $length), function($obj, $method) { |
|
| 287 | 287 | return $obj->$method()->getRelated(); |
| 288 | 288 | }, $model); |
| 289 | 289 | |
@@ -330,7 +330,7 @@ discard block |
||
| 330 | 330 | $relation = $model->{$firstRelationName}; |
| 331 | 331 | |
| 332 | 332 | $results = []; |
| 333 | - if (! empty($relation)) { |
|
| 333 | + if (!empty($relation)) { |
|
| 334 | 334 | if ($relation instanceof Collection) { |
| 335 | 335 | $currentResults = $relation->toArray(); |
| 336 | 336 | } else { |
@@ -339,7 +339,7 @@ discard block |
||
| 339 | 339 | |
| 340 | 340 | array_shift($relationArray); |
| 341 | 341 | |
| 342 | - if (! empty($relationArray)) { |
|
| 342 | + if (!empty($relationArray)) { |
|
| 343 | 343 | foreach ($currentResults as $currentResult) { |
| 344 | 344 | $results = array_merge($results, $this->getRelationModelInstances($currentResult, implode('.', $relationArray))); |
| 345 | 345 | } |
@@ -2,9 +2,9 @@ |
||
| 2 | 2 | |
| 3 | 3 | namespace Backpack\CRUD\Tests\Unit\CrudPanel; |
| 4 | 4 | |
| 5 | -use Faker\Factory; |
|
| 6 | -use Backpack\CRUD\Tests\Unit\Models\User; |
|
| 7 | 5 | use Backpack\CRUD\Tests\Unit\Models\Article; |
| 6 | +use Backpack\CRUD\Tests\Unit\Models\User; |
|
| 7 | +use Faker\Factory; |
|
| 8 | 8 | |
| 9 | 9 | class CrudPanelCreateTest extends BaseDBCrudPanelTest |
| 10 | 10 | { |
@@ -2,9 +2,9 @@ |
||
| 2 | 2 | |
| 3 | 3 | namespace Backpack\CRUD\Tests\Unit\CrudPanel; |
| 4 | 4 | |
| 5 | -use Illuminate\Support\Facades\DB; |
|
| 6 | 5 | use Backpack\CRUD\Tests\Unit\Models\Article; |
| 7 | 6 | use Illuminate\Database\Eloquent\ModelNotFoundException; |
| 7 | +use Illuminate\Support\Facades\DB; |
|
| 8 | 8 | |
| 9 | 9 | class CrudPanelDeleteTest extends BaseDBCrudPanelTest |
| 10 | 10 | { |
@@ -2,11 +2,11 @@ |
||
| 2 | 2 | |
| 3 | 3 | namespace Backpack\CRUD\Tests\Unit\CrudPanel; |
| 4 | 4 | |
| 5 | -use Illuminate\Support\Collection; |
|
| 6 | -use Illuminate\Support\Facades\DB; |
|
| 7 | -use Backpack\CRUD\Tests\Unit\Models\User; |
|
| 8 | 5 | use Backpack\CRUD\Tests\Unit\Models\Article; |
| 6 | +use Backpack\CRUD\Tests\Unit\Models\User; |
|
| 9 | 7 | use Illuminate\Database\Eloquent\ModelNotFoundException; |
| 8 | +use Illuminate\Support\Collection; |
|
| 9 | +use Illuminate\Support\Facades\DB; |
|
| 10 | 10 | |
| 11 | 11 | class CrudPanelReadTest extends BaseDBCrudPanelTest |
| 12 | 12 | { |