We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | // Access |
| 40 | 40 | $this->crud->allowAccess($operationName); |
| 41 | 41 | |
| 42 | - LifecycleHook::hookInto($operationName.':before_setup', function () use ($operationName) { |
|
| 42 | + LifecycleHook::hookInto($operationName.':before_setup', function() use ($operationName) { |
|
| 43 | 43 | // if the backpack.operations.{operationName} config exists, use that one |
| 44 | 44 | // otherwise, use the generic backpack.operations.form config |
| 45 | 45 | if (config()->has('backpack.operations.'.$operationName)) { |
@@ -51,17 +51,17 @@ discard block |
||
| 51 | 51 | // add a reasonable "save and back" save action |
| 52 | 52 | $this->crud->addSaveAction([ |
| 53 | 53 | 'name' => 'save_and_back', |
| 54 | - 'visible' => function ($crud) use ($operationName) { |
|
| 54 | + 'visible' => function($crud) use ($operationName) { |
|
| 55 | 55 | return $crud->hasAccess($operationName); |
| 56 | 56 | }, |
| 57 | - 'redirect' => function ($crud, $request, $itemId = null) { |
|
| 57 | + 'redirect' => function($crud, $request, $itemId = null) { |
|
| 58 | 58 | return $request->request->has('_http_referrer') ? $request->request->get('_http_referrer') : $crud->route; |
| 59 | 59 | }, |
| 60 | 60 | 'button_text' => trans('backpack::crud.save_action_save_and_back'), |
| 61 | 61 | ]); |
| 62 | 62 | }); |
| 63 | 63 | |
| 64 | - LifecycleHook::hookInto(['list:before_setup', 'show:before_setup'], function () use ($operationName, $buttonStack, $buttonMeta) { |
|
| 64 | + LifecycleHook::hookInto(['list:before_setup', 'show:before_setup'], function() use ($operationName, $buttonStack, $buttonMeta) { |
|
| 65 | 65 | $this->crud->button($operationName)->view('crud::buttons.quick')->stack($buttonStack)->meta($buttonMeta); |
| 66 | 66 | }); |
| 67 | 67 | } |
@@ -19,8 +19,8 @@ discard block |
||
| 19 | 19 | * - when true: `address[street]` |
| 20 | 20 | * - when false: `[address][street]` |
| 21 | 21 | */ |
| 22 | -if (! Str::hasMacro('dotsToSquareBrackets')) { |
|
| 23 | - Str::macro('dotsToSquareBrackets', function ($string, $ignore = [], $keyFirst = true) { |
|
| 22 | +if (!Str::hasMacro('dotsToSquareBrackets')) { |
|
| 23 | + Str::macro('dotsToSquareBrackets', function($string, $ignore = [], $keyFirst = true) { |
|
| 24 | 24 | $stringParts = explode('.', $string); |
| 25 | 25 | $result = ''; |
| 26 | 26 | |
@@ -34,8 +34,8 @@ discard block |
||
| 34 | 34 | return $result; |
| 35 | 35 | }); |
| 36 | 36 | } |
| 37 | -if (! CrudColumn::hasMacro('withFiles')) { |
|
| 38 | - CrudColumn::macro('withFiles', function ($uploadDefinition = [], $subfield = null, $registerUploaderEvents = true) { |
|
| 37 | +if (!CrudColumn::hasMacro('withFiles')) { |
|
| 38 | + CrudColumn::macro('withFiles', function($uploadDefinition = [], $subfield = null, $registerUploaderEvents = true) { |
|
| 39 | 39 | /** @var CrudColumn $this */ |
| 40 | 40 | $uploadDefinition = is_array($uploadDefinition) ? $uploadDefinition : []; |
| 41 | 41 | $this->setAttributeValue('withFiles', $uploadDefinition); |
@@ -46,8 +46,8 @@ discard block |
||
| 46 | 46 | }); |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | -if (! CrudField::hasMacro('withFiles')) { |
|
| 50 | - CrudField::macro('withFiles', function ($uploadDefinition = [], $subfield = null, $registerUploaderEvents = true) { |
|
| 49 | +if (!CrudField::hasMacro('withFiles')) { |
|
| 50 | + CrudField::macro('withFiles', function($uploadDefinition = [], $subfield = null, $registerUploaderEvents = true) { |
|
| 51 | 51 | /** @var CrudField $this */ |
| 52 | 52 | $uploadDefinition = is_array($uploadDefinition) ? $uploadDefinition : []; |
| 53 | 53 | $this->setAttributeValue('withFiles', $uploadDefinition); |
@@ -58,8 +58,8 @@ discard block |
||
| 58 | 58 | }); |
| 59 | 59 | } |
| 60 | 60 | |
| 61 | -if (! CrudColumn::hasMacro('linkTo')) { |
|
| 62 | - CrudColumn::macro('linkTo', function (string|array|Closure $routeOrConfiguration, ?array $parameters = []): static { |
|
| 61 | +if (!CrudColumn::hasMacro('linkTo')) { |
|
| 62 | + CrudColumn::macro('linkTo', function(string | array | Closure $routeOrConfiguration, ?array $parameters = []): static { |
|
| 63 | 63 | $wrapper = $this->attributes['wrapper'] ?? []; |
| 64 | 64 | |
| 65 | 65 | // parse the function input to get the actual route and parameters we'll be working with |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | |
| 73 | 73 | // if the route is a closure, we'll just call it |
| 74 | 74 | if ($route instanceof Closure) { |
| 75 | - $wrapper['href'] = function ($crud, $column, $entry, $related_key) use ($route) { |
|
| 75 | + $wrapper['href'] = function($crud, $column, $entry, $related_key) use ($route) { |
|
| 76 | 76 | return $route($entry, $related_key, $column, $crud); |
| 77 | 77 | }; |
| 78 | 78 | $this->wrapper($wrapper); |
@@ -81,13 +81,13 @@ discard block |
||
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | // if the route doesn't exist, we'll throw an exception |
| 84 | - if (! $routeInstance = Route::getRoutes()->getByName($route)) { |
|
| 84 | + if (!$routeInstance = Route::getRoutes()->getByName($route)) { |
|
| 85 | 85 | throw new Exception("Route [{$route}] not found while building the link for column [{$this->attributes['name']}]."); |
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | // calculate the parameters we'll be using for the route() call |
| 89 | 89 | // (eg. if there's only one parameter and user didn't provide it, we'll assume it's the entry's related key) |
| 90 | - $parameters = (function () use ($parameters, $routeInstance, $route) { |
|
| 90 | + $parameters = (function() use ($parameters, $routeInstance, $route) { |
|
| 91 | 91 | $expectedParameters = $routeInstance->parameterNames(); |
| 92 | 92 | |
| 93 | 93 | if (count($expectedParameters) === 0) { |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | if (count($autoInferredParameter) > 1) { |
| 99 | 99 | throw new Exception("Route [{$route}] expects parameters [".implode(', ', $expectedParameters)."]. Insufficient parameters provided in column: [{$this->attributes['name']}]."); |
| 100 | 100 | } |
| 101 | - $autoInferredParameter = current($autoInferredParameter) ? [current($autoInferredParameter) => function ($entry, $related_key, $column, $crud) { |
|
| 101 | + $autoInferredParameter = current($autoInferredParameter) ? [current($autoInferredParameter) => function($entry, $related_key, $column, $crud) { |
|
| 102 | 102 | $entity = $crud->isAttributeInRelationString($column) ? Str::before($column['entity'], '.') : $column['entity']; |
| 103 | 103 | |
| 104 | 104 | return $related_key ?? $entry->{$entity}?->getKey(); |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | })(); |
| 109 | 109 | |
| 110 | 110 | // set up the wrapper href attribute |
| 111 | - $wrapper['href'] = function ($crud, $column, $entry, $related_key) use ($route, $parameters) { |
|
| 111 | + $wrapper['href'] = function($crud, $column, $entry, $related_key) use ($route, $parameters) { |
|
| 112 | 112 | // if the parameter is callable, we'll call it |
| 113 | 113 | $parameters = collect($parameters)->map(fn ($item) => is_callable($item) ? $item($entry, $related_key, $column, $crud) : $item)->toArray(); |
| 114 | 114 | |
@@ -125,17 +125,17 @@ discard block |
||
| 125 | 125 | }); |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | -if (! CrudColumn::hasMacro('linkToShow')) { |
|
| 129 | - CrudColumn::macro('linkToShow', function (): static { |
|
| 128 | +if (!CrudColumn::hasMacro('linkToShow')) { |
|
| 129 | + CrudColumn::macro('linkToShow', function(): static { |
|
| 130 | 130 | $name = $this->attributes['name']; |
| 131 | 131 | $entity = $this->attributes['entity'] ?? null; |
| 132 | 132 | $route = "$entity.show"; |
| 133 | 133 | |
| 134 | - if (! $entity) { |
|
| 134 | + if (!$entity) { |
|
| 135 | 135 | throw new Exception("Entity not found while building the link for column [{$name}]."); |
| 136 | 136 | } |
| 137 | 137 | |
| 138 | - if (! Route::getRoutes()->getByName($route)) { |
|
| 138 | + if (!Route::getRoutes()->getByName($route)) { |
|
| 139 | 139 | throw new Exception("Route '{$route}' not found while building the link for column [{$name}]."); |
| 140 | 140 | } |
| 141 | 141 | |
@@ -146,8 +146,8 @@ discard block |
||
| 146 | 146 | }); |
| 147 | 147 | } |
| 148 | 148 | |
| 149 | -if (! CrudColumn::hasMacro('linkTarget')) { |
|
| 150 | - CrudColumn::macro('linkTarget', function (string $target = '_self'): static { |
|
| 149 | +if (!CrudColumn::hasMacro('linkTarget')) { |
|
| 150 | + CrudColumn::macro('linkTarget', function(string $target = '_self'): static { |
|
| 151 | 151 | $this->wrapper([ |
| 152 | 152 | ...$this->attributes['wrapper'] ?? [], |
| 153 | 153 | 'target' => $target, |
@@ -163,8 +163,8 @@ discard block |
||
| 163 | 163 | * |
| 164 | 164 | * It will go to the given CrudController and get the setupRoutes() method on it. |
| 165 | 165 | */ |
| 166 | -if (! Route::hasMacro('crud')) { |
|
| 167 | - Route::macro('crud', function ($name, $controller) { |
|
| 166 | +if (!Route::hasMacro('crud')) { |
|
| 167 | + Route::macro('crud', function($name, $controller) { |
|
| 168 | 168 | // put together the route name prefix, |
| 169 | 169 | // as passed to the Route::group() statements |
| 170 | 170 | $routeName = ''; |
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | /** |
| 11 | 11 | * Static constructor function. |
| 12 | 12 | */ |
| 13 | - public static function for(array $field, array $configuration): UploaderInterface; |
|
| 13 | + public static function for (array $field, array $configuration): UploaderInterface; |
|
| 14 | 14 | |
| 15 | 15 | /** |
| 16 | 16 | * Default implementation functions. |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | |
| 35 | 35 | public function relationship(bool $isRelation): self; |
| 36 | 36 | |
| 37 | - public function fake(bool|string $isFake): self; |
|
| 37 | + public function fake(bool | string $isFake): self; |
|
| 38 | 38 | |
| 39 | 39 | /** |
| 40 | 40 | * Getters. |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | |
| 52 | 52 | public function getExpirationTimeInMinutes(): int; |
| 53 | 53 | |
| 54 | - public function getFileName(string|UploadedFile $file): string; |
|
| 54 | + public function getFileName(string | UploadedFile $file): string; |
|
| 55 | 55 | |
| 56 | 56 | public function getRepeatableContainerName(): ?string; |
| 57 | 57 | |
@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | { |
| 15 | 15 | $previousImage = $this->getPreviousFiles($entry); |
| 16 | 16 | |
| 17 | - if (! $value && $previousImage) { |
|
| 17 | + if (!$value && $previousImage) { |
|
| 18 | 18 | Storage::disk($this->getDisk())->delete($previousImage); |
| 19 | 19 | |
| 20 | 20 | return null; |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | |
| 68 | 68 | public function shouldKeepPreviousValueUnchanged(Model $entry, $entryValue): bool |
| 69 | 69 | { |
| 70 | - return $entry->exists && is_string($entryValue) && ! Str::startsWith($entryValue, 'data:image'); |
|
| 70 | + return $entry->exists && is_string($entryValue) && !Str::startsWith($entryValue, 'data:image'); |
|
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | public function getUploadedFilesFromRequest() |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | } |
| 146 | 146 | |
| 147 | 147 | // Registering package commands. |
| 148 | - if (! empty($this->commands)) { |
|
| 148 | + if (!empty($this->commands)) { |
|
| 149 | 149 | $this->commands($this->commands); |
| 150 | 150 | } |
| 151 | 151 | } |
@@ -240,7 +240,7 @@ discard block |
||
| 240 | 240 | protected function packageDirectoryExistsAndIsNotEmpty($name) |
| 241 | 241 | { |
| 242 | 242 | // check if directory exists |
| 243 | - if (! is_dir($this->getPath().'/'.$name)) { |
|
| 243 | + if (!is_dir($this->getPath().'/'.$name)) { |
|
| 244 | 244 | return false; |
| 245 | 245 | } |
| 246 | 246 | |
@@ -265,7 +265,7 @@ discard block |
||
| 265 | 265 | public function registerPackageBladeComponents() |
| 266 | 266 | { |
| 267 | 267 | if ($this->componentsNamespace) { |
| 268 | - $this->app->afterResolving(BladeCompiler::class, function () { |
|
| 268 | + $this->app->afterResolving(BladeCompiler::class, function() { |
|
| 269 | 269 | Blade::componentNamespace($this->componentsNamespace, $this->packageName); |
| 270 | 270 | }); |
| 271 | 271 | } |
@@ -20,21 +20,21 @@ discard block |
||
| 20 | 20 | */ |
| 21 | 21 | public function __construct() |
| 22 | 22 | { |
| 23 | - if (! app('router')->getMiddleware()['signed'] ?? null) { |
|
| 23 | + if (!app('router')->getMiddleware()['signed'] ?? null) { |
|
| 24 | 24 | throw new Exception('Missing "signed" alias middleware in App/Http/Kernel.php. More info: https://backpackforlaravel.com/docs/6.x/base-how-to#enable-email-verification-in-backpack-routes'); |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | $this->middleware('signed')->only('verifyEmail'); |
| 28 | 28 | $this->middleware('throttle:'.config('backpack.base.email_verification_throttle_access'))->only('resendVerificationEmail'); |
| 29 | 29 | |
| 30 | - if (! backpack_users_have_email()) { |
|
| 30 | + if (!backpack_users_have_email()) { |
|
| 31 | 31 | abort(500, trans('backpack::base.no_email_column')); |
| 32 | 32 | } |
| 33 | 33 | // where to redirect after the email is verified |
| 34 | 34 | $this->redirectTo = $this->redirectTo ?? backpack_url('dashboard'); |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | - public function emailVerificationRequired(Request $request): \Illuminate\Contracts\View\View|\Illuminate\Http\RedirectResponse |
|
| 37 | + public function emailVerificationRequired(Request $request): \Illuminate\Contracts\View\View | \Illuminate\Http\RedirectResponse |
|
| 38 | 38 | { |
| 39 | 39 | $this->getUserOrRedirect($request); |
| 40 | 40 | |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | return $request->user(backpack_guard_name()) ?? (new UserFromCookie())(); |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | - private function getUserOrRedirect(Request $request): \Illuminate\Contracts\Auth\MustVerifyEmail|\Illuminate\Http\RedirectResponse |
|
| 80 | + private function getUserOrRedirect(Request $request): \Illuminate\Contracts\Auth\MustVerifyEmail | \Illuminate\Http\RedirectResponse |
|
| 81 | 81 | { |
| 82 | 82 | if ($user = $this->getUser($request)) { |
| 83 | 83 | return $user; |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | foreach (app('UploadersRepository')->getRepeatableUploadersFor($this->getRepeatableContainerName()) as $uploader) { |
| 153 | 153 | $uploadedValues = $uploader->uploadRepeatableFiles($values->pluck($uploader->getAttributeName())->toArray(), $this->getPreviousRepeatableValues($entry, $uploader)); |
| 154 | 154 | |
| 155 | - $values = $values->map(function ($item, $key) use ($uploadedValues, $uploader) { |
|
| 155 | + $values = $values->map(function($item, $key) use ($uploadedValues, $uploader) { |
|
| 156 | 156 | $item[$uploader->getAttributeName()] = $uploadedValues[$key] ?? null; |
| 157 | 157 | |
| 158 | 158 | return $item; |
@@ -183,7 +183,7 @@ discard block |
||
| 183 | 183 | |
| 184 | 184 | $values = $entry->{$this->getRepeatableContainerName()}; |
| 185 | 185 | $values = is_string($values) ? json_decode($values, true) : $values; |
| 186 | - $values = array_map(function ($item) use ($repeatableUploaders) { |
|
| 186 | + $values = array_map(function($item) use ($repeatableUploaders) { |
|
| 187 | 187 | foreach ($repeatableUploaders as $upload) { |
| 188 | 188 | $item[$upload->getAttributeName()] = $this->getValuesWithPathStripped($item, $upload); |
| 189 | 189 | } |
@@ -198,7 +198,7 @@ discard block |
||
| 198 | 198 | |
| 199 | 199 | private function retrieveRepeatableRelationFiles(Model $entry) |
| 200 | 200 | { |
| 201 | - switch($this->getRepeatableRelationType()) { |
|
| 201 | + switch ($this->getRepeatableRelationType()) { |
|
| 202 | 202 | case 'BelongsToMany': |
| 203 | 203 | case 'MorphToMany': |
| 204 | 204 | $pivotClass = app('crud')->getModel()->{$this->getUploaderSubfield()['baseEntity']}()->getPivotClass(); |
@@ -251,12 +251,12 @@ discard block |
||
| 251 | 251 | $repeatableValues ??= collect($entry->{$this->getRepeatableContainerName()}); |
| 252 | 252 | |
| 253 | 253 | foreach (app('UploadersRepository')->getRepeatableUploadersFor($this->getRepeatableContainerName()) as $upload) { |
| 254 | - if (! $upload->shouldDeleteFiles()) { |
|
| 254 | + if (!$upload->shouldDeleteFiles()) { |
|
| 255 | 255 | continue; |
| 256 | 256 | } |
| 257 | 257 | $values = $repeatableValues->pluck($upload->getName())->toArray(); |
| 258 | 258 | foreach ($values as $value) { |
| 259 | - if (! $value) { |
|
| 259 | + if (!$value) { |
|
| 260 | 260 | continue; |
| 261 | 261 | } |
| 262 | 262 | |
@@ -279,7 +279,7 @@ discard block |
||
| 279 | 279 | /** |
| 280 | 280 | * Given two multidimensional arrays/collections, merge them recursively. |
| 281 | 281 | */ |
| 282 | - protected function mergeValuesRecursive(array|Collection $array1, array|Collection $array2): array|Collection |
|
| 282 | + protected function mergeValuesRecursive(array | Collection $array1, array | Collection $array2): array | Collection |
|
| 283 | 283 | { |
| 284 | 284 | $merged = $array1; |
| 285 | 285 | foreach ($array2 as $key => &$value) { |
@@ -301,7 +301,7 @@ discard block |
||
| 301 | 301 | { |
| 302 | 302 | $items = CRUD::getRequest()->input('_order_'.$this->getRepeatableContainerName()) ?? []; |
| 303 | 303 | |
| 304 | - array_walk($items, function (&$key, $value) { |
|
| 304 | + array_walk($items, function(&$key, $value) { |
|
| 305 | 305 | $requestValue = $key[$this->getName()] ?? null; |
| 306 | 306 | $key = $this->handleMultipleFiles ? (is_string($requestValue) ? explode(',', $requestValue) : $requestValue) : $requestValue; |
| 307 | 307 | }); |
@@ -313,22 +313,22 @@ discard block |
||
| 313 | 313 | { |
| 314 | 314 | $previousValues = $entry->getOriginal($uploader->getRepeatableContainerName()); |
| 315 | 315 | |
| 316 | - if (! is_array($previousValues)) { |
|
| 316 | + if (!is_array($previousValues)) { |
|
| 317 | 317 | $previousValues = json_decode($previousValues, true); |
| 318 | 318 | } |
| 319 | 319 | |
| 320 | - if (! empty($previousValues)) { |
|
| 320 | + if (!empty($previousValues)) { |
|
| 321 | 321 | $previousValues = array_column($previousValues, $uploader->getName()); |
| 322 | 322 | } |
| 323 | 323 | |
| 324 | 324 | return $previousValues ?? []; |
| 325 | 325 | } |
| 326 | 326 | |
| 327 | - private function getValuesWithPathStripped(array|string|null $item, UploaderInterface $uploader) |
|
| 327 | + private function getValuesWithPathStripped(array | string | null $item, UploaderInterface $uploader) |
|
| 328 | 328 | { |
| 329 | 329 | $uploadedValues = $item[$uploader->getName()] ?? null; |
| 330 | 330 | if (is_array($uploadedValues)) { |
| 331 | - return array_map(function ($value) use ($uploader) { |
|
| 331 | + return array_map(function($value) use ($uploader) { |
|
| 332 | 332 | return $uploader->getValueWithoutPath($value); |
| 333 | 333 | }, $uploadedValues); |
| 334 | 334 | } |
@@ -338,8 +338,8 @@ discard block |
||
| 338 | 338 | |
| 339 | 339 | private function deleteRelationshipFiles(Model $entry): void |
| 340 | 340 | { |
| 341 | - if (! is_a($entry, Pivot::class, true) && |
|
| 342 | - ! $entry->relationLoaded($this->getRepeatableContainerName()) && |
|
| 341 | + if (!is_a($entry, Pivot::class, true) && |
|
| 342 | + !$entry->relationLoaded($this->getRepeatableContainerName()) && |
|
| 343 | 343 | method_exists($entry, $this->getRepeatableContainerName()) |
| 344 | 344 | ) { |
| 345 | 345 | $entry->loadMissing($this->getRepeatableContainerName()); |
@@ -366,8 +366,8 @@ discard block |
||
| 366 | 366 | $relatedEntries = $entry->{$this->getRepeatableContainerName()} ?? []; |
| 367 | 367 | } |
| 368 | 368 | |
| 369 | - if (! is_a($relatedEntries ?? '', Collection::class, true)) { |
|
| 370 | - $relatedEntries = ! empty($relatedEntries) ? [$relatedEntries] : [$entry]; |
|
| 369 | + if (!is_a($relatedEntries ?? '', Collection::class, true)) { |
|
| 370 | + $relatedEntries = !empty($relatedEntries) ? [$relatedEntries] : [$entry]; |
|
| 371 | 371 | } |
| 372 | 372 | |
| 373 | 373 | foreach ($relatedEntries as $relatedEntry) { |
@@ -375,9 +375,9 @@ discard block |
||
| 375 | 375 | } |
| 376 | 376 | } |
| 377 | 377 | |
| 378 | - protected function deletePivotFiles(Pivot|Model $entry) |
|
| 378 | + protected function deletePivotFiles(Pivot | Model $entry) |
|
| 379 | 379 | { |
| 380 | - if (! is_a($entry, Pivot::class, true)) { |
|
| 380 | + if (!is_a($entry, Pivot::class, true)) { |
|
| 381 | 381 | $pivots = $entry->{$this->getRepeatableContainerName()}; |
| 382 | 382 | foreach ($pivots as $pivot) { |
| 383 | 383 | $this->deletePivotModelFiles($pivot); |
@@ -387,24 +387,24 @@ discard block |
||
| 387 | 387 | } |
| 388 | 388 | |
| 389 | 389 | $pivotAttributes = $entry->getAttributes(); |
| 390 | - $connectedPivot = $entry->pivotParent->{$this->getRepeatableContainerName()}->where(function ($item) use ($pivotAttributes) { |
|
| 390 | + $connectedPivot = $entry->pivotParent->{$this->getRepeatableContainerName()}->where(function($item) use ($pivotAttributes) { |
|
| 391 | 391 | $itemPivotAttributes = $item->pivot->only(array_keys($pivotAttributes)); |
| 392 | 392 | |
| 393 | 393 | return $itemPivotAttributes === $pivotAttributes; |
| 394 | 394 | })->first(); |
| 395 | 395 | |
| 396 | - if (! $connectedPivot) { |
|
| 396 | + if (!$connectedPivot) { |
|
| 397 | 397 | return; |
| 398 | 398 | } |
| 399 | 399 | |
| 400 | 400 | $this->deletePivotModelFiles($connectedPivot); |
| 401 | 401 | } |
| 402 | 402 | |
| 403 | - private function deletePivotModelFiles(Pivot|Model $entry) |
|
| 403 | + private function deletePivotModelFiles(Pivot | Model $entry) |
|
| 404 | 404 | { |
| 405 | 405 | $files = $entry->getOriginal()['pivot_'.$this->getAttributeName()]; |
| 406 | 406 | |
| 407 | - if (! $files) { |
|
| 407 | + if (!$files) { |
|
| 408 | 408 | return; |
| 409 | 409 | } |
| 410 | 410 | |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | */ |
| 35 | 35 | public function markAsHandled(string $objectName): void |
| 36 | 36 | { |
| 37 | - if (! in_array($objectName, $this->handledUploaders)) { |
|
| 37 | + if (!in_array($objectName, $this->handledUploaders)) { |
|
| 38 | 38 | $this->handledUploaders[] = $objectName; |
| 39 | 39 | } |
| 40 | 40 | } |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | */ |
| 61 | 61 | public function getUploadFor(string $objectType, string $group): string |
| 62 | 62 | { |
| 63 | - if (! $this->hasUploadFor($objectType, $group)) { |
|
| 63 | + if (!$this->hasUploadFor($objectType, $group)) { |
|
| 64 | 64 | throw new \Exception('There is no uploader defined for the given field type.'); |
| 65 | 65 | } |
| 66 | 66 | |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | { |
| 83 | 83 | // ensure all uploaders implement the UploaderInterface |
| 84 | 84 | foreach ($uploaders as $uploader) { |
| 85 | - if (! is_a($uploader, UploaderInterface::class, true)) { |
|
| 85 | + if (!is_a($uploader, UploaderInterface::class, true)) { |
|
| 86 | 86 | throw new \Exception('The uploader class must implement the UploaderInterface.'); |
| 87 | 87 | } |
| 88 | 88 | } |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | */ |
| 103 | 103 | public function registerRepeatableUploader(string $uploadName, UploaderInterface $uploader): void |
| 104 | 104 | { |
| 105 | - if (! array_key_exists($uploadName, $this->repeatableUploaders) || ! in_array($uploader, $this->repeatableUploaders[$uploadName])) { |
|
| 105 | + if (!array_key_exists($uploadName, $this->repeatableUploaders) || !in_array($uploader, $this->repeatableUploaders[$uploadName])) { |
|
| 106 | 106 | $this->repeatableUploaders[$uploadName][] = $uploader; |
| 107 | 107 | } |
| 108 | 108 | } |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | */ |
| 137 | 137 | public function getRegisteredUploadNames(string $uploadName): array |
| 138 | 138 | { |
| 139 | - return array_map(function ($uploader) { |
|
| 139 | + return array_map(function($uploader) { |
|
| 140 | 140 | return $uploader->getName(); |
| 141 | 141 | }, $this->getRepeatableUploadersFor($uploadName)); |
| 142 | 142 | } |
@@ -167,11 +167,11 @@ discard block |
||
| 167 | 167 | |
| 168 | 168 | $uploaders = $this->getRepeatableUploadersFor($repeatableContainerName); |
| 169 | 169 | |
| 170 | - $uploader = Arr::first($uploaders, function ($uploader) use ($requestInputName) { |
|
| 170 | + $uploader = Arr::first($uploaders, function($uploader) use ($requestInputName) { |
|
| 171 | 171 | return $uploader->getName() === $requestInputName; |
| 172 | 172 | }); |
| 173 | 173 | |
| 174 | - if (! $uploader) { |
|
| 174 | + if (!$uploader) { |
|
| 175 | 175 | abort(500, 'Could not find the field in the repeatable uploaders.'); |
| 176 | 176 | } |
| 177 | 177 | |
@@ -182,16 +182,16 @@ discard block |
||
| 182 | 182 | abort(500, 'Could not find the field in the CRUD fields.'); |
| 183 | 183 | } |
| 184 | 184 | |
| 185 | - if (! $uploaderMacro = $this->getUploadCrudObjectMacroType($crudObject)) { |
|
| 185 | + if (!$uploaderMacro = $this->getUploadCrudObjectMacroType($crudObject)) { |
|
| 186 | 186 | abort(500, 'There is no uploader defined for the given field type.'); |
| 187 | 187 | } |
| 188 | 188 | |
| 189 | - if (! $this->isValidUploadField($crudObject, $uploaderMacro)) { |
|
| 189 | + if (!$this->isValidUploadField($crudObject, $uploaderMacro)) { |
|
| 190 | 190 | abort(500, 'Invalid field for upload.'); |
| 191 | 191 | } |
| 192 | 192 | |
| 193 | 193 | $uploaderConfiguration = $crudObject[$uploaderMacro] ?? []; |
| 194 | - $uploaderConfiguration = ! is_array($uploaderConfiguration) ? [] : $uploaderConfiguration; |
|
| 194 | + $uploaderConfiguration = !is_array($uploaderConfiguration) ? [] : $uploaderConfiguration; |
|
| 195 | 195 | $uploaderClass = $this->getUploadFor($crudObject['type'], $uploaderMacro); |
| 196 | 196 | |
| 197 | 197 | return new $uploaderClass(['name' => $requestInputName], $uploaderConfiguration); |
@@ -217,11 +217,11 @@ discard block |
||
| 217 | 217 | { |
| 218 | 218 | if (Str::contains($crudObject['name'], '#')) { |
| 219 | 219 | $container = Str::before($crudObject['name'], '#'); |
| 220 | - $field = array_filter(CRUD::fields()[$container]['subfields'] ?? [], function ($item) use ($crudObject, $uploaderMacro) { |
|
| 220 | + $field = array_filter(CRUD::fields()[$container]['subfields'] ?? [], function($item) use ($crudObject, $uploaderMacro) { |
|
| 221 | 221 | return $item['name'] === $crudObject['name'] && in_array($item['type'], $this->getAjaxUploadTypes($uploaderMacro)); |
| 222 | 222 | }); |
| 223 | 223 | |
| 224 | - return ! empty($field); |
|
| 224 | + return !empty($field); |
|
| 225 | 225 | } |
| 226 | 226 | |
| 227 | 227 | return in_array($crudObject['type'], $this->getAjaxUploadTypes($uploaderMacro)); |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | public function addFakes($columns = ['extras']) |
| 21 | 21 | { |
| 22 | 22 | foreach ($columns as $key => $column) { |
| 23 | - if (! isset($this->attributes[$column])) { |
|
| 23 | + if (!isset($this->attributes[$column])) { |
|
| 24 | 24 | continue; |
| 25 | 25 | } |
| 26 | 26 | |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | */ |
| 68 | 68 | public function shouldDecodeFake($column) |
| 69 | 69 | { |
| 70 | - return ! in_array($column, array_keys($this->getCasts())); |
|
| 70 | + return !in_array($column, array_keys($this->getCasts())); |
|
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | /** |
@@ -78,6 +78,6 @@ discard block |
||
| 78 | 78 | */ |
| 79 | 79 | public function shouldEncodeFake($column) |
| 80 | 80 | { |
| 81 | - return ! in_array($column, array_keys($this->getCasts())); |
|
| 81 | + return !in_array($column, array_keys($this->getCasts())); |
|
| 82 | 82 | } |
| 83 | 83 | } |