We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
@@ -175,6 +175,7 @@ |
||
| 175 | 175 | |
| 176 | 176 | /** |
| 177 | 177 | * Set the number of rows that should be show on the list view. |
| 178 | + * @param integer $value |
|
| 178 | 179 | */ |
| 179 | 180 | public function setDefaultPageLength($value) |
| 180 | 181 | { |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | { |
| 39 | 39 | $id = $this->getCurrentEntryId(); |
| 40 | 40 | |
| 41 | - if (! $id) { |
|
| 41 | + if (!$id) { |
|
| 42 | 42 | return false; |
| 43 | 43 | } |
| 44 | 44 | |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | */ |
| 55 | 55 | public function getEntry($id) |
| 56 | 56 | { |
| 57 | - if (! $this->entry) { |
|
| 57 | + if (!$this->entry) { |
|
| 58 | 58 | $this->entry = $this->model->findOrFail($id); |
| 59 | 59 | $this->entry = $this->entry->withFakes(); |
| 60 | 60 | } |
@@ -203,7 +203,7 @@ discard block |
||
| 203 | 203 | { |
| 204 | 204 | // If the default Page Length isn't in the menu's values, Add it the beginnin and resort all to show a croissant list. |
| 205 | 205 | // assume both arrays are the same length. |
| 206 | - if (! in_array($this->getDefaultPageLength(), $this->getOperationSetting('pageLengthMenu')[0])) { |
|
| 206 | + if (!in_array($this->getDefaultPageLength(), $this->getOperationSetting('pageLengthMenu')[0])) { |
|
| 207 | 207 | // Loop through 2 arrays of prop. pageLengthMenu |
| 208 | 208 | foreach ($this->getOperationSetting('pageLengthMenu') as $key => &$page_length_choices) { |
| 209 | 209 | // This is a condition that should be always true. |
@@ -301,6 +301,9 @@ discard block |
||
| 301 | 301 | return $this->getShowView(); |
| 302 | 302 | } |
| 303 | 303 | |
| 304 | + /** |
|
| 305 | + * @param string $view |
|
| 306 | + */ |
|
| 304 | 307 | public function setPreviewView($view) |
| 305 | 308 | { |
| 306 | 309 | return $this->setShowView($view); |
@@ -311,6 +314,9 @@ discard block |
||
| 311 | 314 | return $this->getEditView(); |
| 312 | 315 | } |
| 313 | 316 | |
| 317 | + /** |
|
| 318 | + * @param string $view |
|
| 319 | + */ |
|
| 314 | 320 | public function setUpdateView($view) |
| 315 | 321 | { |
| 316 | 322 | return $this->setEditView($view); |
@@ -54,13 +54,13 @@ discard block |
||
| 54 | 54 | public function register() |
| 55 | 55 | { |
| 56 | 56 | // Bind the CrudPanel object to Laravel's service container |
| 57 | - $this->app->singleton('crud', function ($app) { |
|
| 57 | + $this->app->singleton('crud', function($app) { |
|
| 58 | 58 | return new \Backpack\CRUD\app\Library\CrudPanel\CrudPanel($app); |
| 59 | 59 | }); |
| 60 | 60 | |
| 61 | 61 | // load a macro for Route, |
| 62 | 62 | // helps developers load all routes for a CRUD resource in one line |
| 63 | - if (! Route::hasMacro('crud')) { |
|
| 63 | + if (!Route::hasMacro('crud')) { |
|
| 64 | 64 | $this->addRouteMacro(); |
| 65 | 65 | } |
| 66 | 66 | |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | // } |
| 82 | 82 | |
| 83 | 83 | // map the elfinder prefix |
| 84 | - if (! \Config::get('elfinder.route.prefix')) { |
|
| 84 | + if (!\Config::get('elfinder.route.prefix')) { |
|
| 85 | 85 | \Config::set('elfinder.route.prefix', \Config::get('backpack.base.route_prefix').'/elfinder'); |
| 86 | 86 | } |
| 87 | 87 | } |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | $middleware_key = config('backpack.base.middleware_key'); |
| 92 | 92 | $middleware_class = config('backpack.base.middleware_class'); |
| 93 | 93 | |
| 94 | - if (! is_array($middleware_class)) { |
|
| 94 | + if (!is_array($middleware_class)) { |
|
| 95 | 95 | $router->pushMiddlewareToGroup($middleware_key, $middleware_class); |
| 96 | 96 | |
| 97 | 97 | return; |
@@ -195,7 +195,7 @@ discard block |
||
| 195 | 195 | */ |
| 196 | 196 | private function addRouteMacro() |
| 197 | 197 | { |
| 198 | - Route::macro('crud', function ($name, $controller) { |
|
| 198 | + Route::macro('crud', function($name, $controller) { |
|
| 199 | 199 | // put together the route name prefix, |
| 200 | 200 | // as passed to the Route::group() statements |
| 201 | 201 | $routeName = ''; |
@@ -17,7 +17,7 @@ |
||
| 17 | 17 | return; |
| 18 | 18 | } |
| 19 | 19 | |
| 20 | - if (! $this->validCode(config('backpack.base.license_code'))) { |
|
| 20 | + if (!$this->validCode(config('backpack.base.license_code'))) { |
|
| 21 | 21 | \Alert::add('warning', "<strong>You're using unlicensed software.</strong> Please ask your web developer to <a target='_blank' class='alert-link text-white' href='http://backpackforlaravel.com'>purchase a license code</a> to hide this message."); |
| 22 | 22 | } |
| 23 | 23 | } |
@@ -9,7 +9,6 @@ |
||
| 9 | 9 | /** |
| 10 | 10 | * Define which routes are needed for this operation. |
| 11 | 11 | * |
| 12 | - * @param string $name Name of the current entity (singular). Used as first URL segment. |
|
| 13 | 12 | * @param string $routeName Prefix of the route name. |
| 14 | 13 | * @param string $controller Name of the current CrudController. |
| 15 | 14 | */ |
@@ -36,11 +36,11 @@ discard block |
||
| 36 | 36 | $this->crud->set('reorder.enabled', true); |
| 37 | 37 | $this->crud->allowAccess('reorder'); |
| 38 | 38 | |
| 39 | - $this->crud->operation('reorder', function () { |
|
| 39 | + $this->crud->operation('reorder', function() { |
|
| 40 | 40 | $this->crud->loadDefaultOperationSettingsFromConfig(); |
| 41 | 41 | }); |
| 42 | 42 | |
| 43 | - $this->crud->operation('list', function () { |
|
| 43 | + $this->crud->operation('list', function() { |
|
| 44 | 44 | $this->crud->addButton('top', 'reorder', 'view', 'crud::buttons.reorder'); |
| 45 | 45 | }); |
| 46 | 46 | } |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | { |
| 57 | 57 | $this->crud->hasAccessOrFail('reorder'); |
| 58 | 58 | |
| 59 | - if (! $this->crud->isReorderEnabled()) { |
|
| 59 | + if (!$this->crud->isReorderEnabled()) { |
|
| 60 | 60 | abort(403, 'Reorder is disabled.'); |
| 61 | 61 | } |
| 62 | 62 | |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | /** |
| 142 | 142 | * Move the most recently added column after the given target column. |
| 143 | 143 | * |
| 144 | - * @param string|array $targetColumn The target column name or array. |
|
| 144 | + * @param string $targetColumn The target column name or array. |
|
| 145 | 145 | */ |
| 146 | 146 | public function afterColumn($targetColumn) |
| 147 | 147 | { |
@@ -161,7 +161,7 @@ discard block |
||
| 161 | 161 | /** |
| 162 | 162 | * Move this column to be first in the columns list. |
| 163 | 163 | * |
| 164 | - * @return bool|null |
|
| 164 | + * @return false|null |
|
| 165 | 165 | */ |
| 166 | 166 | public function makeFirstColumn() |
| 167 | 167 | { |
@@ -239,7 +239,7 @@ discard block |
||
| 239 | 239 | /** |
| 240 | 240 | * Remove a column from the CRUD panel by name. |
| 241 | 241 | * |
| 242 | - * @param string $column The column key. |
|
| 242 | + * @param string $columnKey The column key. |
|
| 243 | 243 | */ |
| 244 | 244 | public function removeColumn($columnKey) |
| 245 | 245 | { |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | public function addColumn($column) |
| 64 | 64 | { |
| 65 | 65 | // if a string was passed, not an array, change it to an array |
| 66 | - if (! is_array($column)) { |
|
| 66 | + if (!is_array($column)) { |
|
| 67 | 67 | $column = ['name' => $column]; |
| 68 | 68 | } |
| 69 | 69 | |
@@ -71,17 +71,17 @@ discard block |
||
| 71 | 71 | $column_with_details = $this->addDefaultLabel($column); |
| 72 | 72 | |
| 73 | 73 | // make sure the column has a name |
| 74 | - if (! array_key_exists('name', $column_with_details)) { |
|
| 74 | + if (!array_key_exists('name', $column_with_details)) { |
|
| 75 | 75 | $column_with_details['name'] = 'anonymous_column_'.str_random(5); |
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | // make sure the column has a type |
| 79 | - if (! array_key_exists('type', $column_with_details)) { |
|
| 79 | + if (!array_key_exists('type', $column_with_details)) { |
|
| 80 | 80 | $column_with_details['type'] = 'text'; |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | // make sure the column has a key |
| 84 | - if (! array_key_exists('key', $column_with_details)) { |
|
| 84 | + if (!array_key_exists('key', $column_with_details)) { |
|
| 85 | 85 | $column_with_details['key'] = str_replace('.', '__', $column_with_details['name']); |
| 86 | 86 | } |
| 87 | 87 | |
@@ -89,17 +89,17 @@ discard block |
||
| 89 | 89 | $columnExistsInDb = $this->hasColumn($this->model->getTable(), $column_with_details['name']); |
| 90 | 90 | |
| 91 | 91 | // make sure the column has a tableColumn boolean |
| 92 | - if (! array_key_exists('tableColumn', $column_with_details)) { |
|
| 92 | + if (!array_key_exists('tableColumn', $column_with_details)) { |
|
| 93 | 93 | $column_with_details['tableColumn'] = $columnExistsInDb ? true : false; |
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | // make sure the column has a orderable boolean |
| 97 | - if (! array_key_exists('orderable', $column_with_details)) { |
|
| 97 | + if (!array_key_exists('orderable', $column_with_details)) { |
|
| 98 | 98 | $column_with_details['orderable'] = $columnExistsInDb ? true : false; |
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | // make sure the column has a searchLogic |
| 102 | - if (! array_key_exists('searchLogic', $column_with_details)) { |
|
| 102 | + if (!array_key_exists('searchLogic', $column_with_details)) { |
|
| 103 | 103 | $column_with_details['searchLogic'] = $columnExistsInDb ? true : false; |
| 104 | 104 | } |
| 105 | 105 | |
@@ -108,14 +108,14 @@ discard block |
||
| 108 | 108 | |
| 109 | 109 | // make sure the column has a priority in terms of visibility |
| 110 | 110 | // if no priority has been defined, use the order in the array plus one |
| 111 | - if (! array_key_exists('priority', $column_with_details)) { |
|
| 111 | + if (!array_key_exists('priority', $column_with_details)) { |
|
| 112 | 112 | $position_in_columns_array = (int) array_search($column_with_details['key'], array_keys($this->columns())); |
| 113 | 113 | $columnsArray[$column_with_details['key']]['priority'] = $position_in_columns_array + 1; |
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | // if this is a relation type field and no corresponding model was specified, get it from the relation method |
| 117 | 117 | // defined in the main model |
| 118 | - if (isset($column_with_details['entity']) && ! isset($column_with_details['model'])) { |
|
| 118 | + if (isset($column_with_details['entity']) && !isset($column_with_details['model'])) { |
|
| 119 | 119 | $columnsArray[$column_with_details['key']]['model'] = $this->getRelationModel($column_with_details['entity']); |
| 120 | 120 | } |
| 121 | 121 | |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | */ |
| 166 | 166 | public function makeFirstColumn() |
| 167 | 167 | { |
| 168 | - if (! $this->columns()) { |
|
| 168 | + if (!$this->columns()) { |
|
| 169 | 169 | return false; |
| 170 | 170 | } |
| 171 | 171 | |
@@ -187,8 +187,7 @@ discard block |
||
| 187 | 187 | $columnsArray = $this->columns(); |
| 188 | 188 | |
| 189 | 189 | if (array_key_exists($targetColumnName, $columnsArray)) { |
| 190 | - $targetColumnPosition = $before ? array_search($targetColumnName, array_keys($columnsArray)) : |
|
| 191 | - array_search($targetColumnName, array_keys($columnsArray)) + 1; |
|
| 190 | + $targetColumnPosition = $before ? array_search($targetColumnName, array_keys($columnsArray)) : array_search($targetColumnName, array_keys($columnsArray)) + 1; |
|
| 192 | 191 | |
| 193 | 192 | $element = array_pop($columnsArray); |
| 194 | 193 | $beginningPart = array_slice($columnsArray, 0, $targetColumnPosition, true); |
@@ -227,7 +226,7 @@ discard block |
||
| 227 | 226 | */ |
| 228 | 227 | public function addDefaultLabel($array) |
| 229 | 228 | { |
| 230 | - if (! array_key_exists('label', (array) $array) && array_key_exists('name', (array) $array)) { |
|
| 229 | + if (!array_key_exists('label', (array) $array) && array_key_exists('name', (array) $array)) { |
|
| 231 | 230 | $array = array_merge(['label' => mb_ucfirst($this->makeLabel($array['name']))], $array); |
| 232 | 231 | |
| 233 | 232 | return $array; |
@@ -255,7 +254,7 @@ discard block |
||
| 255 | 254 | */ |
| 256 | 255 | public function removeColumns($columns) |
| 257 | 256 | { |
| 258 | - if (! empty($columns)) { |
|
| 257 | + if (!empty($columns)) { |
|
| 259 | 258 | foreach ($columns as $columnKey) { |
| 260 | 259 | $this->removeColumn($columnKey); |
| 261 | 260 | } |
@@ -334,7 +333,7 @@ discard block |
||
| 334 | 333 | { |
| 335 | 334 | $columns = $this->columns(); |
| 336 | 335 | |
| 337 | - return collect($columns)->pluck('entity')->reject(function ($value, $key) { |
|
| 336 | + return collect($columns)->pluck('entity')->reject(function($value, $key) { |
|
| 338 | 337 | return $value == null; |
| 339 | 338 | })->toArray(); |
| 340 | 339 | } |
@@ -19,7 +19,7 @@ |
||
| 19 | 19 | * |
| 20 | 20 | * TODO: should this delete items with relations to it too? |
| 21 | 21 | * |
| 22 | - * @return bool True if the item was deleted. |
|
| 22 | + * @return string True if the item was deleted. |
|
| 23 | 23 | */ |
| 24 | 24 | public function delete($id) |
| 25 | 25 | { |
@@ -113,7 +113,7 @@ |
||
| 113 | 113 | * |
| 114 | 114 | * @param string $key Has no operation prepended. (ex: exportButtons) |
| 115 | 115 | * |
| 116 | - * @return mixed [description] |
|
| 116 | + * @return boolean [description] |
|
| 117 | 117 | */ |
| 118 | 118 | public function hasOperationSetting(string $key, $operation = null) |
| 119 | 119 | { |
@@ -55,7 +55,7 @@ |
||
| 55 | 55 | */ |
| 56 | 56 | public function settings() |
| 57 | 57 | { |
| 58 | - return array_sort($this->settings, function ($value, $key) { |
|
| 58 | + return array_sort($this->settings, function($value, $key) { |
|
| 59 | 59 | return $key; |
| 60 | 60 | }); |
| 61 | 61 | } |
@@ -22,36 +22,36 @@ |
||
| 22 | 22 | } |
| 23 | 23 | } |
| 24 | 24 | |
| 25 | - //for update form, get initial state of the entity |
|
| 26 | - if (isset($id) && $id) { |
|
| 25 | + //for update form, get initial state of the entity |
|
| 26 | + if (isset($id) && $id) { |
|
| 27 | 27 | |
| 28 | 28 | //get entity with relations for primary dependency |
| 29 | - $entity_dependencies = $entity_model->with($primary_dependency['entity']) |
|
| 30 | - ->with($primary_dependency['entity'].'.'.$primary_dependency['entity_secondary']) |
|
| 31 | - ->find($id); |
|
| 29 | + $entity_dependencies = $entity_model->with($primary_dependency['entity']) |
|
| 30 | + ->with($primary_dependency['entity'].'.'.$primary_dependency['entity_secondary']) |
|
| 31 | + ->find($id); |
|
| 32 | 32 | |
| 33 | - $secondaries_from_primary = []; |
|
| 33 | + $secondaries_from_primary = []; |
|
| 34 | 34 | |
| 35 | - //convert relation in array |
|
| 36 | - $primary_array = $entity_dependencies->{$primary_dependency['entity']}->toArray(); |
|
| 35 | + //convert relation in array |
|
| 36 | + $primary_array = $entity_dependencies->{$primary_dependency['entity']}->toArray(); |
|
| 37 | 37 | |
| 38 | - $secondary_ids = []; |
|
| 38 | + $secondary_ids = []; |
|
| 39 | 39 | |
| 40 | - //create secondary dependency from primary relation, used to check what chekbox must be check from second checklist |
|
| 41 | - if (old($primary_dependency['name'])) { |
|
| 42 | - foreach (old($primary_dependency['name']) as $primary_item) { |
|
| 43 | - foreach ($dependencyArray[$primary_item] as $second_item) { |
|
| 44 | - $secondary_ids[$second_item] = $second_item; |
|
| 45 | - } |
|
| 46 | - } |
|
| 47 | - } else { //create dependecies from relation if not from validate error |
|
| 48 | - foreach ($primary_array as $primary_item) { |
|
| 49 | - foreach ($primary_item[$secondary_dependency['entity']] as $second_item) { |
|
| 50 | - $secondary_ids[$second_item['id']] = $second_item['id']; |
|
| 51 | - } |
|
| 52 | - } |
|
| 53 | - } |
|
| 54 | - } |
|
| 40 | + //create secondary dependency from primary relation, used to check what chekbox must be check from second checklist |
|
| 41 | + if (old($primary_dependency['name'])) { |
|
| 42 | + foreach (old($primary_dependency['name']) as $primary_item) { |
|
| 43 | + foreach ($dependencyArray[$primary_item] as $second_item) { |
|
| 44 | + $secondary_ids[$second_item] = $second_item; |
|
| 45 | + } |
|
| 46 | + } |
|
| 47 | + } else { //create dependecies from relation if not from validate error |
|
| 48 | + foreach ($primary_array as $primary_item) { |
|
| 49 | + foreach ($primary_item[$secondary_dependency['entity']] as $second_item) { |
|
| 50 | + $secondary_ids[$second_item['id']] = $second_item['id']; |
|
| 51 | + } |
|
| 52 | + } |
|
| 53 | + } |
|
| 54 | + } |
|
| 55 | 55 | |
| 56 | 56 | //json encode of dependency matrix |
| 57 | 57 | $dependencyJson = json_encode($dependencyArray); |