We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
@@ -2,8 +2,8 @@ |
||
| 2 | 2 | |
| 3 | 3 | namespace Backpack\CRUD\app\Http\Requests; |
| 4 | 4 | |
| 5 | -use Illuminate\Support\Facades\Hash; |
|
| 6 | 5 | use Illuminate\Foundation\Http\FormRequest; |
| 6 | +use Illuminate\Support\Facades\Hash; |
|
| 7 | 7 | |
| 8 | 8 | class ChangePasswordRequest extends FormRequest |
| 9 | 9 | { |
@@ -41,9 +41,9 @@ |
||
| 41 | 41 | */ |
| 42 | 42 | public function withValidator($validator) |
| 43 | 43 | { |
| 44 | - $validator->after(function ($validator) { |
|
| 44 | + $validator->after(function($validator) { |
|
| 45 | 45 | // check old password matches |
| 46 | - if (! Hash::check($this->input('old_password'), backpack_auth()->user()->password)) { |
|
| 46 | + if (!Hash::check($this->input('old_password'), backpack_auth()->user()->password)) { |
|
| 47 | 47 | $validator->errors()->add('old_password', trans('backpack::base.old_password_incorrect')); |
| 48 | 48 | } |
| 49 | 49 | }); |
@@ -2,33 +2,33 @@ |
||
| 2 | 2 | |
| 3 | 3 | namespace Backpack\CRUD\app\Library\CrudPanel; |
| 4 | 4 | |
| 5 | -use Illuminate\Database\Eloquent\Collection; |
|
| 6 | -use Backpack\CRUD\app\Library\CrudPanel\Traits\Read; |
|
| 7 | -use Backpack\CRUD\app\Library\CrudPanel\Traits\Tabs; |
|
| 8 | -use Backpack\CRUD\app\Library\CrudPanel\Traits\Query; |
|
| 9 | -use Backpack\CRUD\app\Library\CrudPanel\Traits\Views; |
|
| 10 | 5 | use Backpack\CRUD\app\Library\CrudPanel\Traits\Access; |
| 6 | +use Backpack\CRUD\app\Library\CrudPanel\Traits\AutoFocus; |
|
| 7 | +use Backpack\CRUD\app\Library\CrudPanel\Traits\AutoSet; |
|
| 8 | +use Backpack\CRUD\app\Library\CrudPanel\Traits\Buttons; |
|
| 9 | +use Backpack\CRUD\app\Library\CrudPanel\Traits\Columns; |
|
| 11 | 10 | use Backpack\CRUD\app\Library\CrudPanel\Traits\Create; |
| 12 | 11 | use Backpack\CRUD\app\Library\CrudPanel\Traits\Delete; |
| 13 | 12 | use Backpack\CRUD\app\Library\CrudPanel\Traits\Errors; |
| 13 | +use Backpack\CRUD\app\Library\CrudPanel\Traits\FakeColumns; |
|
| 14 | +use Backpack\CRUD\app\Library\CrudPanel\Traits\FakeFields; |
|
| 14 | 15 | use Backpack\CRUD\app\Library\CrudPanel\Traits\Fields; |
| 15 | -use Backpack\CRUD\app\Library\CrudPanel\Traits\Search; |
|
| 16 | -use Backpack\CRUD\app\Library\CrudPanel\Traits\Update; |
|
| 17 | -use Backpack\CRUD\app\Library\CrudPanel\Traits\AutoSet; |
|
| 18 | -use Backpack\CRUD\app\Library\CrudPanel\Traits\Buttons; |
|
| 19 | -use Backpack\CRUD\app\Library\CrudPanel\Traits\Columns; |
|
| 20 | 16 | use Backpack\CRUD\app\Library\CrudPanel\Traits\Filters; |
| 21 | -use Backpack\CRUD\app\Library\CrudPanel\Traits\Reorder; |
|
| 22 | -use Backpack\CRUD\app\Library\CrudPanel\Traits\Settings; |
|
| 23 | -use Backpack\CRUD\app\Library\CrudPanel\Traits\AutoFocus; |
|
| 17 | +use Backpack\CRUD\app\Library\CrudPanel\Traits\HeadingsAndTitles; |
|
| 24 | 18 | use Backpack\CRUD\app\Library\CrudPanel\Traits\Macroable; |
| 25 | -use Backpack\CRUD\app\Library\CrudPanel\Traits\FakeFields; |
|
| 26 | 19 | use Backpack\CRUD\app\Library\CrudPanel\Traits\Operations; |
| 27 | -use Backpack\CRUD\app\Library\CrudPanel\Traits\Validation; |
|
| 28 | -use Backpack\CRUD\app\Library\CrudPanel\Traits\FakeColumns; |
|
| 20 | +use Backpack\CRUD\app\Library\CrudPanel\Traits\Query; |
|
| 21 | +use Backpack\CRUD\app\Library\CrudPanel\Traits\Read; |
|
| 22 | +use Backpack\CRUD\app\Library\CrudPanel\Traits\Reorder; |
|
| 29 | 23 | use Backpack\CRUD\app\Library\CrudPanel\Traits\SaveActions; |
| 30 | -use Backpack\CRUD\app\Library\CrudPanel\Traits\HeadingsAndTitles; |
|
| 24 | +use Backpack\CRUD\app\Library\CrudPanel\Traits\Search; |
|
| 25 | +use Backpack\CRUD\app\Library\CrudPanel\Traits\Settings; |
|
| 26 | +use Backpack\CRUD\app\Library\CrudPanel\Traits\Tabs; |
|
| 27 | +use Backpack\CRUD\app\Library\CrudPanel\Traits\Update; |
|
| 28 | +use Backpack\CRUD\app\Library\CrudPanel\Traits\Validation; |
|
| 29 | +use Backpack\CRUD\app\Library\CrudPanel\Traits\Views; |
|
| 31 | 30 | use Backpack\CRUD\app\Library\CrudPanel\Traits\ViewsAndRestoresRevisions; |
| 31 | +use Illuminate\Database\Eloquent\Collection; |
|
| 32 | 32 | |
| 33 | 33 | class CrudPanel |
| 34 | 34 | { |
@@ -76,11 +76,11 @@ discard block |
||
| 76 | 76 | */ |
| 77 | 77 | public function setModel($model_namespace) |
| 78 | 78 | { |
| 79 | - if (! class_exists($model_namespace)) { |
|
| 79 | + if (!class_exists($model_namespace)) { |
|
| 80 | 80 | throw new \Exception('The model does not exist.', 500); |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | - if (! method_exists($model_namespace, 'hasCrudTrait')) { |
|
| 83 | + if (!method_exists($model_namespace, 'hasCrudTrait')) { |
|
| 84 | 84 | throw new \Exception('Please use CrudTrait on the model.', 500); |
| 85 | 85 | } |
| 86 | 86 | |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | { |
| 144 | 144 | $complete_route = $route.'.index'; |
| 145 | 145 | |
| 146 | - if (! \Route::has($complete_route)) { |
|
| 146 | + if (!\Route::has($complete_route)) { |
|
| 147 | 147 | throw new \Exception('There are no routes for this route name.', 404); |
| 148 | 148 | } |
| 149 | 149 | |
@@ -244,7 +244,7 @@ discard block |
||
| 244 | 244 | */ |
| 245 | 245 | public function getFirstOfItsTypeInArray($type, $array) |
| 246 | 246 | { |
| 247 | - return array_first($array, function ($item) use ($type) { |
|
| 247 | + return array_first($array, function($item) use ($type) { |
|
| 248 | 248 | return $item['type'] == $type; |
| 249 | 249 | }); |
| 250 | 250 | } |
@@ -261,8 +261,8 @@ discard block |
||
| 261 | 261 | |
| 262 | 262 | public function sync($type, $fields, $attributes) |
| 263 | 263 | { |
| 264 | - if (! empty($this->{$type})) { |
|
| 265 | - $this->{$type} = array_map(function ($field) use ($fields, $attributes) { |
|
| 264 | + if (!empty($this->{$type})) { |
|
| 265 | + $this->{$type} = array_map(function($field) use ($fields, $attributes) { |
|
| 266 | 266 | if (in_array($field['name'], (array) $fields)) { |
| 267 | 267 | $field = array_merge($field, $attributes); |
| 268 | 268 | } |
@@ -294,15 +294,15 @@ discard block |
||
| 294 | 294 | { |
| 295 | 295 | $relationArray = explode('.', $relationString); |
| 296 | 296 | |
| 297 | - if (! isset($length)) { |
|
| 297 | + if (!isset($length)) { |
|
| 298 | 298 | $length = count($relationArray); |
| 299 | 299 | } |
| 300 | 300 | |
| 301 | - if (! isset($model)) { |
|
| 301 | + if (!isset($model)) { |
|
| 302 | 302 | $model = $this->model; |
| 303 | 303 | } |
| 304 | 304 | |
| 305 | - $result = array_reduce(array_splice($relationArray, 0, $length), function ($obj, $method) { |
|
| 305 | + $result = array_reduce(array_splice($relationArray, 0, $length), function($obj, $method) { |
|
| 306 | 306 | return $obj->$method()->getRelated(); |
| 307 | 307 | }, $model); |
| 308 | 308 | |
@@ -352,7 +352,7 @@ discard block |
||
| 352 | 352 | $relation = $model->{$firstRelationName}; |
| 353 | 353 | |
| 354 | 354 | $results = []; |
| 355 | - if (! empty($relation)) { |
|
| 355 | + if (!empty($relation)) { |
|
| 356 | 356 | if ($relation instanceof Collection) { |
| 357 | 357 | $currentResults = $relation->toArray(); |
| 358 | 358 | } else { |
@@ -361,7 +361,7 @@ discard block |
||
| 361 | 361 | |
| 362 | 362 | array_shift($relationArray); |
| 363 | 363 | |
| 364 | - if (! empty($relationArray)) { |
|
| 364 | + if (!empty($relationArray)) { |
|
| 365 | 365 | foreach ($currentResults as $currentResult) { |
| 366 | 366 | $results = array_merge($results, $this->getRelationModelInstances($currentResult, implode('.', $relationArray))); |
| 367 | 367 | } |
@@ -12,6 +12,9 @@ |
||
| 12 | 12 | return $this->getOperationSetting('autoFocusOnFirstField'); |
| 13 | 13 | } |
| 14 | 14 | |
| 15 | + /** |
|
| 16 | + * @param boolean $value |
|
| 17 | + */ |
|
| 15 | 18 | public function setAutoFocusOnFirstField($value) |
| 16 | 19 | { |
| 17 | 20 | return $this->setOperationSetting('autoFocusOnFirstField', (bool) $value); |
@@ -159,7 +159,7 @@ |
||
| 159 | 159 | * @param \Illuminate\Database\Eloquent\Model $item The current CRUD model. |
| 160 | 160 | * @param array $formattedData The form data. |
| 161 | 161 | * |
| 162 | - * @return bool|null |
|
| 162 | + * @return false|null |
|
| 163 | 163 | */ |
| 164 | 164 | private function createRelationsForItem($item, $formattedData) |
| 165 | 165 | { |
@@ -2,8 +2,8 @@ |
||
| 2 | 2 | |
| 3 | 3 | namespace Backpack\CRUD\app\Library\CrudPanel\Traits; |
| 4 | 4 | |
| 5 | -use Illuminate\Database\Eloquent\Relations\HasOne; |
|
| 6 | 5 | use Illuminate\Database\Eloquent\Relations\BelongsTo; |
| 6 | +use Illuminate\Database\Eloquent\Relations\HasOne; |
|
| 7 | 7 | |
| 8 | 8 | trait Create |
| 9 | 9 | { |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | { |
| 82 | 82 | $all_relation_fields = $this->getRelationFields(); |
| 83 | 83 | |
| 84 | - return array_where($all_relation_fields, function ($value, $key) { |
|
| 84 | + return array_where($all_relation_fields, function($value, $key) { |
|
| 85 | 85 | return isset($value['pivot']) && $value['pivot']; |
| 86 | 86 | }); |
| 87 | 87 | } |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | */ |
| 157 | 157 | private function createRelationsForItem($item, $formattedData) |
| 158 | 158 | { |
| 159 | - if (! isset($formattedData['relations'])) { |
|
| 159 | + if (!isset($formattedData['relations'])) { |
|
| 160 | 160 | return false; |
| 161 | 161 | } |
| 162 | 162 | |
@@ -213,11 +213,11 @@ discard block |
||
| 213 | 213 | $key = implode('.relations.', explode('.', $relationField['entity'])); |
| 214 | 214 | $fieldData = array_get($relationData, 'relations.'.$key, []); |
| 215 | 215 | |
| 216 | - if (! array_key_exists('model', $fieldData)) { |
|
| 216 | + if (!array_key_exists('model', $fieldData)) { |
|
| 217 | 217 | $fieldData['model'] = $relationField['model']; |
| 218 | 218 | } |
| 219 | 219 | |
| 220 | - if (! array_key_exists('parent', $fieldData)) { |
|
| 220 | + if (!array_key_exists('parent', $fieldData)) { |
|
| 221 | 221 | $fieldData['parent'] = $this->getRelationModel($relationField['entity'], -1); |
| 222 | 222 | } |
| 223 | 223 | |
@@ -10,8 +10,6 @@ |
||
| 10 | 10 | * plus the '_token' and 'redirect_after_save' variables. |
| 11 | 11 | * |
| 12 | 12 | * @param array $requestInput The request input. |
| 13 | - * @param string $form The CRUD form. Can be 'create' or 'update' . Default is 'create'. |
|
| 14 | - * @param int|bool $id The CRUD entry id in the case of the 'update' form. |
|
| 15 | 13 | * |
| 16 | 14 | * @see \Illuminate\Http\Request::all() For an example on how to get the request input. |
| 17 | 15 | * |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | $fakeFieldKey = isset($field['store_in']) ? $field['store_in'] : 'extras'; |
| 33 | 33 | $this->addCompactedField($requestInput, $fieldName, $fakeFieldKey); |
| 34 | 34 | |
| 35 | - if (! in_array($fakeFieldKey, $compactedFakeFields)) { |
|
| 35 | + if (!in_array($fakeFieldKey, $compactedFakeFields)) { |
|
| 36 | 36 | $compactedFakeFields[] = $fakeFieldKey; |
| 37 | 37 | } |
| 38 | 38 | } |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | |
| 42 | 42 | // json_encode all fake_value columns if applicable in the database, so they can be properly stored and interpreted |
| 43 | 43 | foreach ($compactedFakeFields as $value) { |
| 44 | - if (! (property_exists($this->model, 'translatable') && in_array($value, $this->model->getTranslatableAttributes(), true)) && $this->model->shouldEncodeFake($value)) { |
|
| 44 | + if (!(property_exists($this->model, 'translatable') && in_array($value, $this->model->getTranslatableAttributes(), true)) && $this->model->shouldEncodeFake($value)) { |
|
| 45 | 45 | $requestInput[$value] = json_encode($requestInput[$value]); |
| 46 | 46 | } |
| 47 | 47 | } |
@@ -35,6 +35,7 @@ discard block |
||
| 35 | 35 | |
| 36 | 36 | /** |
| 37 | 37 | * Apply the search logic for each CRUD column. |
| 38 | + * @param string $searchTerm |
|
| 38 | 39 | */ |
| 39 | 40 | public function applySearchLogicForColumn($query, $column, $searchTerm) |
| 40 | 41 | { |
@@ -230,7 +231,7 @@ discard block |
||
| 230 | 231 | * |
| 231 | 232 | * @param string $view |
| 232 | 233 | * @param array $column |
| 233 | - * @param object $entry |
|
| 234 | + * @param \Illuminate\Database\Eloquent\Model $entry |
|
| 234 | 235 | * @param bool|int $rowNumber The number shown to the user as row number (index) |
| 235 | 236 | * |
| 236 | 237 | * @return string |
@@ -2,8 +2,8 @@ |
||
| 2 | 2 | |
| 3 | 3 | namespace Backpack\CRUD\app\Library\CrudPanel\Traits; |
| 4 | 4 | |
| 5 | -use Validator; |
|
| 6 | 5 | use Carbon\Carbon; |
| 6 | +use Validator; |
|
| 7 | 7 | |
| 8 | 8 | trait Search |
| 9 | 9 | { |
@@ -210,10 +210,10 @@ |
||
| 210 | 210 | // add the details_row button to the first column |
| 211 | 211 | if ($this->getOperationSetting('detailsRow')) { |
| 212 | 212 | $details_row_button = \View::make('crud::columns.details_row_button') |
| 213 | - ->with('crud', $this) |
|
| 214 | - ->with('entry', $entry) |
|
| 215 | - ->with('row_number', $rowNumber) |
|
| 216 | - ->render(); |
|
| 213 | + ->with('crud', $this) |
|
| 214 | + ->with('entry', $entry) |
|
| 215 | + ->with('row_number', $rowNumber) |
|
| 216 | + ->render(); |
|
| 217 | 217 | $row_items[0] = $details_row_button.$row_items[0]; |
| 218 | 218 | } |
| 219 | 219 | |
@@ -22,9 +22,9 @@ discard block |
||
| 22 | 22 | */ |
| 23 | 23 | public function applySearchTerm($searchTerm) |
| 24 | 24 | { |
| 25 | - return $this->query->where(function ($query) use ($searchTerm) { |
|
| 25 | + return $this->query->where(function($query) use ($searchTerm) { |
|
| 26 | 26 | foreach ($this->columns() as $column) { |
| 27 | - if (! isset($column['type'])) { |
|
| 27 | + if (!isset($column['type'])) { |
|
| 28 | 28 | abort(400, 'Missing column type when trying to apply search term.'); |
| 29 | 29 | } |
| 30 | 30 | |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | |
| 83 | 83 | case 'select': |
| 84 | 84 | case 'select_multiple': |
| 85 | - $query->orWhereHas($column['entity'], function ($q) use ($column, $searchTerm) { |
|
| 85 | + $query->orWhereHas($column['entity'], function($q) use ($column, $searchTerm) { |
|
| 86 | 86 | $q->where($column['attribute'], 'like', '%'.$searchTerm.'%'); |
| 87 | 87 | }); |
| 88 | 88 | break; |
@@ -274,7 +274,7 @@ discard block |
||
| 274 | 274 | */ |
| 275 | 275 | private function renderCellView($view, $column, $entry, $rowNumber = false) |
| 276 | 276 | { |
| 277 | - if (! view()->exists($view)) { |
|
| 277 | + if (!view()->exists($view)) { |
|
| 278 | 278 | $view = 'crud::columns.text'; // fallback to text column |
| 279 | 279 | } |
| 280 | 280 | |
@@ -35,6 +35,9 @@ |
||
| 35 | 35 | return ! $this->tabsEnabled(); |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | + /** |
|
| 39 | + * @param string $type |
|
| 40 | + */ |
|
| 38 | 41 | public function setTabsType($type) |
| 39 | 42 | { |
| 40 | 43 | $this->enableTabs(); |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | */ |
| 33 | 33 | public function tabsDisabled() |
| 34 | 34 | { |
| 35 | - return ! $this->tabsEnabled(); |
|
| 35 | + return !$this->tabsEnabled(); |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | public function setTabsType($type) |
@@ -114,8 +114,8 @@ discard block |
||
| 114 | 114 | { |
| 115 | 115 | $all_fields = $this->getCurrentFields(); |
| 116 | 116 | |
| 117 | - $fields_without_a_tab = collect($all_fields)->filter(function ($value, $key) { |
|
| 118 | - return ! isset($value['tab']); |
|
| 117 | + $fields_without_a_tab = collect($all_fields)->filter(function($value, $key) { |
|
| 118 | + return !isset($value['tab']); |
|
| 119 | 119 | }); |
| 120 | 120 | |
| 121 | 121 | return $fields_without_a_tab; |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | if ($this->tabExists($label)) { |
| 132 | 132 | $all_fields = $this->getCurrentFields(); |
| 133 | 133 | |
| 134 | - $fields_for_current_tab = collect($all_fields)->filter(function ($value, $key) use ($label) { |
|
| 134 | + $fields_for_current_tab = collect($all_fields)->filter(function($value, $key) use ($label) { |
|
| 135 | 135 | return isset($value['tab']) && $value['tab'] == $label; |
| 136 | 136 | }); |
| 137 | 137 | |
@@ -150,11 +150,11 @@ discard block |
||
| 150 | 150 | $fields = $this->getCurrentFields(); |
| 151 | 151 | |
| 152 | 152 | $fields_with_tabs = collect($fields) |
| 153 | - ->filter(function ($value, $key) { |
|
| 153 | + ->filter(function($value, $key) { |
|
| 154 | 154 | return isset($value['tab']); |
| 155 | 155 | }) |
| 156 | - ->each(function ($value, $key) use (&$tabs) { |
|
| 157 | - if (! in_array($value['tab'], $tabs)) { |
|
| 156 | + ->each(function($value, $key) use (&$tabs) { |
|
| 157 | + if (!in_array($value['tab'], $tabs)) { |
|
| 158 | 158 | $tabs[] = $value['tab']; |
| 159 | 159 | } |
| 160 | 160 | }); |
@@ -69,7 +69,7 @@ |
||
| 69 | 69 | * |
| 70 | 70 | * @param array $columns - the database columns that contain the JSONs |
| 71 | 71 | * |
| 72 | - * @return Model |
|
| 72 | + * @return CrudTrait |
|
| 73 | 73 | */ |
| 74 | 74 | public function withFakes($columns = []) |
| 75 | 75 | { |
@@ -3,9 +3,9 @@ |
||
| 3 | 3 | namespace Backpack\CRUD\app\Models\Traits; |
| 4 | 4 | |
| 5 | 5 | use DB; |
| 6 | -use Traversable; |
|
| 7 | -use Illuminate\Support\Facades\Config; |
|
| 8 | 6 | use Illuminate\Database\Eloquent\Model; |
| 7 | +use Illuminate\Support\Facades\Config; |
|
| 8 | +use Traversable; |
|
| 9 | 9 | |
| 10 | 10 | trait CrudTrait |
| 11 | 11 | { |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | $conn->getDoctrineSchemaManager()->getDatabasePlatform()->registerDoctrineTypeMapping('json', 'json_array'); |
| 70 | 70 | $conn->getDoctrineSchemaManager()->getDatabasePlatform()->registerDoctrineTypeMapping('jsonb', 'json_array'); |
| 71 | 71 | |
| 72 | - return ! $conn->getDoctrineColumn($table, $column_name)->getNotnull(); |
|
| 72 | + return !$conn->getDoctrineColumn($table, $column_name)->getNotnull(); |
|
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | /* |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | public function addFakes($columns = ['extras']) |
| 87 | 87 | { |
| 88 | 88 | foreach ($columns as $key => $column) { |
| 89 | - if (! isset($this->attributes[$column])) { |
|
| 89 | + if (!isset($this->attributes[$column])) { |
|
| 90 | 90 | continue; |
| 91 | 91 | } |
| 92 | 92 | |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | */ |
| 135 | 135 | public function shouldDecodeFake($column) |
| 136 | 136 | { |
| 137 | - return ! in_array($column, array_keys($this->casts)); |
|
| 137 | + return !in_array($column, array_keys($this->casts)); |
|
| 138 | 138 | } |
| 139 | 139 | |
| 140 | 140 | /** |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | */ |
| 146 | 146 | public function shouldEncodeFake($column) |
| 147 | 147 | { |
| 148 | - return ! in_array($column, array_keys($this->casts)); |
|
| 148 | + return !in_array($column, array_keys($this->casts)); |
|
| 149 | 149 | } |
| 150 | 150 | |
| 151 | 151 | /* |
@@ -219,7 +219,7 @@ discard block |
||
| 219 | 219 | public function uploadMultipleFilesToDisk($value, $attribute_name, $disk, $destination_path) |
| 220 | 220 | { |
| 221 | 221 | $request = \Request::instance(); |
| 222 | - if (! is_array($this->{$attribute_name})) { |
|
| 222 | + if (!is_array($this->{$attribute_name})) { |
|
| 223 | 223 | $attribute_value = json_decode($this->{$attribute_name}, true) ?? []; |
| 224 | 224 | } else { |
| 225 | 225 | $attribute_value = $this->{$attribute_name}; |
@@ -231,7 +231,7 @@ discard block |
||
| 231 | 231 | if ($files_to_clear) { |
| 232 | 232 | foreach ($files_to_clear as $key => $filename) { |
| 233 | 233 | \Storage::disk($disk)->delete($filename); |
| 234 | - $attribute_value = array_where($attribute_value, function ($value, $key) use ($filename) { |
|
| 234 | + $attribute_value = array_where($attribute_value, function($value, $key) use ($filename) { |
|
| 235 | 235 | return $value != $filename; |
| 236 | 236 | }); |
| 237 | 237 | } |
@@ -5,7 +5,7 @@ discard block |
||
| 5 | 5 | * Appends the configured backpack prefix and returns |
| 6 | 6 | * the URL using the standard Laravel helpers. |
| 7 | 7 | * |
| 8 | - * @param $path |
|
| 8 | + * @param string $path |
|
| 9 | 9 | * |
| 10 | 10 | * @return string |
| 11 | 11 | */ |
@@ -156,6 +156,7 @@ discard block |
||
| 156 | 156 | * If that view doesn't exist, it will load the one from the original theme. |
| 157 | 157 | * |
| 158 | 158 | * @param string (see config/backpack/base.php) |
| 159 | + * @param string $view |
|
| 159 | 160 | * |
| 160 | 161 | * @return string |
| 161 | 162 | */ |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -if (! function_exists('backpack_url')) { |
|
| 3 | +if (!function_exists('backpack_url')) { |
|
| 4 | 4 | /** |
| 5 | 5 | * Appends the configured backpack prefix and returns |
| 6 | 6 | * the URL using the standard Laravel helpers. |
@@ -11,13 +11,13 @@ discard block |
||
| 11 | 11 | */ |
| 12 | 12 | function backpack_url($path = null, $parameters = [], $secure = null) |
| 13 | 13 | { |
| 14 | - $path = ! $path || (substr($path, 0, 1) == '/') ? $path : '/'.$path; |
|
| 14 | + $path = !$path || (substr($path, 0, 1) == '/') ? $path : '/'.$path; |
|
| 15 | 15 | |
| 16 | 16 | return url(config('backpack.base.route_prefix', 'admin').$path, $parameters = [], $secure = null); |
| 17 | 17 | } |
| 18 | 18 | } |
| 19 | 19 | |
| 20 | -if (! function_exists('backpack_authentication_column')) { |
|
| 20 | +if (!function_exists('backpack_authentication_column')) { |
|
| 21 | 21 | /** |
| 22 | 22 | * Return the username column name. |
| 23 | 23 | * The Laravel default (and Backpack default) is 'email'. |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | } |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | -if (! function_exists('backpack_users_have_email')) { |
|
| 33 | +if (!function_exists('backpack_users_have_email')) { |
|
| 34 | 34 | /** |
| 35 | 35 | * Check if the email column is present on the user table. |
| 36 | 36 | * |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | } |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | -if (! function_exists('backpack_avatar_url')) { |
|
| 48 | +if (!function_exists('backpack_avatar_url')) { |
|
| 49 | 49 | /** |
| 50 | 50 | * Returns the avatar URL of a user. |
| 51 | 51 | * |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | } |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | -if (! function_exists('backpack_middleware')) { |
|
| 81 | +if (!function_exists('backpack_middleware')) { |
|
| 82 | 82 | /** |
| 83 | 83 | * Return the key of the middleware used across Backpack. |
| 84 | 84 | * That middleware checks if the visitor is an admin. |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | } |
| 94 | 94 | } |
| 95 | 95 | |
| 96 | -if (! function_exists('backpack_guard_name')) { |
|
| 96 | +if (!function_exists('backpack_guard_name')) { |
|
| 97 | 97 | /* |
| 98 | 98 | * Returns the name of the guard defined |
| 99 | 99 | * by the application config |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | } |
| 105 | 105 | } |
| 106 | 106 | |
| 107 | -if (! function_exists('backpack_auth')) { |
|
| 107 | +if (!function_exists('backpack_auth')) { |
|
| 108 | 108 | /* |
| 109 | 109 | * Returns the user instance if it exists |
| 110 | 110 | * of the currently authenticated admin |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | } |
| 117 | 117 | } |
| 118 | 118 | |
| 119 | -if (! function_exists('backpack_user')) { |
|
| 119 | +if (!function_exists('backpack_user')) { |
|
| 120 | 120 | /* |
| 121 | 121 | * Returns back a user instance without |
| 122 | 122 | * the admin guard, however allows you |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | } |
| 129 | 129 | } |
| 130 | 130 | |
| 131 | -if (! function_exists('mb_ucfirst')) { |
|
| 131 | +if (!function_exists('mb_ucfirst')) { |
|
| 132 | 132 | /** |
| 133 | 133 | * Capitalize the first letter of a string, |
| 134 | 134 | * even if that string is multi-byte (non-latin alphabet). |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | } |
| 151 | 151 | } |
| 152 | 152 | |
| 153 | -if (! function_exists('backpack_view')) { |
|
| 153 | +if (!function_exists('backpack_view')) { |
|
| 154 | 154 | /** |
| 155 | 155 | * Returns a new displayable view based on the configured backpack view namespace. |
| 156 | 156 | * If that view doesn't exist, it will load the one from the original theme. |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | |
| 170 | 170 | $returnView = $theme.$view; |
| 171 | 171 | |
| 172 | - if (! view()->exists($returnView)) { |
|
| 172 | + if (!view()->exists($returnView)) { |
|
| 173 | 173 | $returnView = $originalTheme.$view; |
| 174 | 174 | } |
| 175 | 175 | |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | } |
| 178 | 178 | } |
| 179 | 179 | |
| 180 | -if (! function_exists('square_brackets_to_dots')) { |
|
| 180 | +if (!function_exists('square_brackets_to_dots')) { |
|
| 181 | 181 | /** |
| 182 | 182 | * Turns a string from bracket-type array to dot-notation array. |
| 183 | 183 | * Ex: array[0][property] turns into array.0.property. |
@@ -194,7 +194,7 @@ discard block |
||
| 194 | 194 | } |
| 195 | 195 | } |
| 196 | 196 | |
| 197 | -if (! function_exists('is_countable')) { |
|
| 197 | +if (!function_exists('is_countable')) { |
|
| 198 | 198 | /** |
| 199 | 199 | * We need this because is_countable was only introduced in PHP 7.3, |
| 200 | 200 | * and in PHP 7.2 you should check if count() argument is really countable. |