We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | */ |
88 | 88 | public function key(string $key) |
89 | 89 | { |
90 | - if (! isset($this->attributes['name'])) { |
|
90 | + if (!isset($this->attributes['name'])) { |
|
91 | 91 | abort(500, 'Column name must be defined before changing the key.', ['developer-error-exception']); |
92 | 92 | } |
93 | 93 | |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | */ |
180 | 180 | public function subfields($subfields) |
181 | 181 | { |
182 | - $callAttributeMacro = ! isset($this->attributes['subfields']); |
|
182 | + $callAttributeMacro = !isset($this->attributes['subfields']); |
|
183 | 183 | $this->attributes['subfields'] = $subfields; |
184 | 184 | $this->attributes = $this->crud()->makeSureColumnHasNeededAttributes($this->attributes); |
185 | 185 | if ($callAttributeMacro) { |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | 'operation' => 'list', |
28 | 28 | ]); |
29 | 29 | |
30 | - if (! isset($this->setupDetailsRowRoute) || $this->setupDetailsRowRoute === true) { |
|
30 | + if (!isset($this->setupDetailsRowRoute) || $this->setupDetailsRowRoute === true) { |
|
31 | 31 | Route::get($segment.'/{id}/details', [ |
32 | 32 | 'as' => $routeName.'.showDetailsRow', |
33 | 33 | 'uses' => $controller.'@showDetailsRow', |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | { |
44 | 44 | $this->crud->allowAccess('list'); |
45 | 45 | |
46 | - $this->crud->operation('list', function () { |
|
46 | + $this->crud->operation('list', function() { |
|
47 | 47 | $this->crud->loadDefaultOperationSettingsFromConfig(); |
48 | 48 | $this->crud->setOperationSetting('datatablesUrl', $this->crud->getRoute()); |
49 | 49 | }); |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | $search = request()->input('search'); |
82 | 82 | |
83 | 83 | // check if length is allowed by developer |
84 | - if ($length && ! in_array($length, $this->crud->getPageLengthMenu()[0])) { |
|
84 | + if ($length && !in_array($length, $this->crud->getPageLengthMenu()[0])) { |
|
85 | 85 | return response()->json([ |
86 | 86 | 'error' => 'Unknown page length.', |
87 | 87 | ], 400); |
@@ -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; |
@@ -29,13 +29,13 @@ discard block |
||
29 | 29 | |
30 | 30 | public bool $implicit = true; |
31 | 31 | |
32 | - public static function field(string|array|ValidationRule|Rule $rules = []): self |
|
32 | + public static function field(string | array | ValidationRule | Rule $rules = []): self |
|
33 | 33 | { |
34 | 34 | $instance = new static(); |
35 | 35 | $instance->fieldRules = self::getRulesAsArray($rules); |
36 | 36 | |
37 | 37 | if ($instance->validatesArrays()) { |
38 | - if (! in_array('array', $instance->getFieldRules())) { |
|
38 | + if (!in_array('array', $instance->getFieldRules())) { |
|
39 | 39 | $instance->fieldRules[] = 'array'; |
40 | 40 | } |
41 | 41 | } |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | |
96 | 96 | public function getFieldRules(): array |
97 | 97 | { |
98 | - return tap($this->fieldRules, function ($rule) { |
|
98 | + return tap($this->fieldRules, function($rule) { |
|
99 | 99 | if (is_a($rule, BackpackCustomRule::class, true)) { |
100 | 100 | $rule = $rule->getFieldRules(); |
101 | 101 | } |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | $rules = explode('|', $rules); |
111 | 111 | } |
112 | 112 | |
113 | - if (! is_array($rules)) { |
|
113 | + if (!is_array($rules)) { |
|
114 | 114 | $rules = [$rules]; |
115 | 115 | } |
116 | 116 | |
@@ -119,10 +119,10 @@ discard block |
||
119 | 119 | |
120 | 120 | protected function ensureValueIsValid($value) |
121 | 121 | { |
122 | - if ($this->validatesArrays() && ! is_array($value)) { |
|
122 | + if ($this->validatesArrays() && !is_array($value)) { |
|
123 | 123 | try { |
124 | 124 | $value = json_decode($value, true) ?? []; |
125 | - } catch(\Exception $e) { |
|
125 | + } catch (\Exception $e) { |
|
126 | 126 | return false; |
127 | 127 | } |
128 | 128 | } |
@@ -141,12 +141,12 @@ discard block |
||
141 | 141 | $attribute => $rules, |
142 | 142 | ], $this->validator->customMessages, $this->getValidatorCustomAttributes($attribute)); |
143 | 143 | |
144 | - return $validator->errors()->messages()[$attribute] ?? (! empty($validator->errors()->messages()) ? current($validator->errors()->messages()) : []); |
|
144 | + return $validator->errors()->messages()[$attribute] ?? (!empty($validator->errors()->messages()) ? current($validator->errors()->messages()) : []); |
|
145 | 145 | } |
146 | 146 | |
147 | 147 | private function getValidatorCustomAttributes(string $attribute): array |
148 | 148 | { |
149 | - if (! is_a($this, ValidGenericAjaxEndpoint::class) && ! Str::contains($attribute, '.*.')) { |
|
149 | + if (!is_a($this, ValidGenericAjaxEndpoint::class) && !Str::contains($attribute, '.*.')) { |
|
150 | 150 | return $this->validator->customAttributes; |
151 | 151 | } |
152 | 152 | |
@@ -157,8 +157,7 @@ discard block |
||
157 | 157 | protected function getValidationAttributeString(string $attribute) |
158 | 158 | { |
159 | 159 | return Str::substrCount($attribute, '.') > 1 ? |
160 | - Str::before($attribute, '.').'.*.'.Str::afterLast($attribute, '.') : |
|
161 | - $attribute; |
|
160 | + Str::before($attribute, '.').'.*.'.Str::afterLast($attribute, '.') : $attribute; |
|
162 | 161 | } |
163 | 162 | |
164 | 163 | protected function validateOnSubmit(string $attribute, mixed $value): array |
@@ -178,7 +177,7 @@ discard block |
||
178 | 177 | /** |
179 | 178 | * Implementation. |
180 | 179 | */ |
181 | - public function validateFieldRules(string $attribute, array|string|UploadedFile|null $data = null, ?array $customRules = null): array |
|
180 | + public function validateFieldRules(string $attribute, array | string | UploadedFile | null $data = null, ?array $customRules = null): array |
|
182 | 181 | { |
183 | 182 | $data = $data ?? $this->data; |
184 | 183 | $validationRuleAttribute = $this->getValidationAttributeString($attribute); |
@@ -187,16 +186,16 @@ discard block |
||
187 | 186 | return $this->validateAndGetErrors($validationRuleAttribute, $data, $customRules ?? $this->getFieldRules()); |
188 | 187 | } |
189 | 188 | |
190 | - protected function prepareValidatorData(array|string|UploadedFile $data, string $attribute): array |
|
189 | + protected function prepareValidatorData(array | string | UploadedFile $data, string $attribute): array |
|
191 | 190 | { |
192 | - if ($this->validatesArrays() && is_array($data) && ! Str::contains($attribute, '.')) { |
|
191 | + if ($this->validatesArrays() && is_array($data) && !Str::contains($attribute, '.')) { |
|
193 | 192 | return Arr::has($data, $attribute) ? $data : [$attribute => $data]; |
194 | 193 | } |
195 | 194 | |
196 | 195 | if (Str::contains($attribute, '.')) { |
197 | 196 | $validData = []; |
198 | 197 | |
199 | - Arr::set($validData, $attribute, ! is_array($data) ? $data : Arr::get($data, $attribute)); |
|
198 | + Arr::set($validData, $attribute, !is_array($data) ? $data : Arr::get($data, $attribute)); |
|
200 | 199 | |
201 | 200 | return $validData; |
202 | 201 | } |
@@ -211,7 +210,7 @@ discard block |
||
211 | 210 | $validationRuleAttribute = $this->getValidationAttributeString($attribute); |
212 | 211 | |
213 | 212 | $filesToValidate = Arr::get($items, $attribute); |
214 | - $filesToValidate = is_array($filesToValidate) ? array_filter($filesToValidate, function ($item) { |
|
213 | + $filesToValidate = is_array($filesToValidate) ? array_filter($filesToValidate, function($item) { |
|
215 | 214 | return $item instanceof UploadedFile; |
216 | 215 | }) : (is_a($filesToValidate, UploadedFile::class, true) ? [$filesToValidate] : []); |
217 | 216 |
@@ -14,18 +14,18 @@ discard block |
||
14 | 14 | private string $crudObjectType; |
15 | 15 | |
16 | 16 | public function __construct( |
17 | - private readonly CrudField|CrudColumn $crudObject, |
|
17 | + private readonly CrudField | CrudColumn $crudObject, |
|
18 | 18 | private readonly array $uploaderConfiguration, |
19 | 19 | private readonly string $macro |
20 | 20 | ) { |
21 | 21 | $this->crudObjectType = is_a($crudObject, CrudField::class) ? 'field' : (is_a($crudObject, CrudColumn::class) ? 'column' : null); |
22 | 22 | |
23 | - if (! $this->crudObjectType) { |
|
23 | + if (!$this->crudObjectType) { |
|
24 | 24 | abort(500, 'Upload handlers only work for CrudField and CrudColumn classes.', ['developer-error-exception']); |
25 | 25 | } |
26 | 26 | } |
27 | 27 | |
28 | - public static function handle(CrudField|CrudColumn $crudObject, array $uploaderConfiguration, string $macro, ?array $subfield = null, bool $registerModelEvents = true): void |
|
28 | + public static function handle(CrudField | CrudColumn $crudObject, array $uploaderConfiguration, string $macro, ?array $subfield = null, bool $registerModelEvents = true): void |
|
29 | 29 | { |
30 | 30 | $instance = new self($crudObject, $uploaderConfiguration, $macro); |
31 | 31 | |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | *******************************/ |
38 | 38 | private function registerEvents(?array $subfield = [], bool $registerModelEvents = true): void |
39 | 39 | { |
40 | - if (! empty($subfield)) { |
|
40 | + if (!empty($subfield)) { |
|
41 | 41 | $this->registerSubfieldEvent($subfield, $registerModelEvents); |
42 | 42 | |
43 | 43 | return; |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | } |
83 | 83 | |
84 | 84 | $subfields = collect($this->crudObject->getAttributes()['subfields']); |
85 | - $subfields = $subfields->map(function ($item) use ($subfield, $uploader) { |
|
85 | + $subfields = $subfields->map(function($item) use ($subfield, $uploader) { |
|
86 | 86 | if ($item['name'] === $subfield['name']) { |
87 | 87 | $item['upload'] = true; |
88 | 88 | $item['disk'] = $uploader->getDisk(); |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | } |
113 | 113 | |
114 | 114 | if ($this->crudObjectType === 'field') { |
115 | - $model::saving(function ($entry) use ($uploader) { |
|
115 | + $model::saving(function($entry) use ($uploader) { |
|
116 | 116 | $entry = $uploader->storeUploadedFiles($entry); |
117 | 117 | }); |
118 | 118 | } |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | // is not called in pivot models when loading the relations. |
126 | 126 | $retrieveModel = $this->getModelForRetrieveEvent($model, $uploader); |
127 | 127 | |
128 | - $retrieveModel::retrieved(function ($entry) use ($uploader) { |
|
128 | + $retrieveModel::retrieved(function($entry) use ($uploader) { |
|
129 | 129 | if ($entry->translationEnabled()) { |
130 | 130 | $locale = request('_locale', app()->getLocale()); |
131 | 131 | if (in_array($locale, array_keys($entry->getAvailableLocales()))) { |
@@ -136,14 +136,14 @@ discard block |
||
136 | 136 | }); |
137 | 137 | } |
138 | 138 | |
139 | - $model::deleting(function ($entry) use ($uploader) { |
|
139 | + $model::deleting(function($entry) use ($uploader) { |
|
140 | 140 | $uploader->deleteUploadedFiles($entry); |
141 | 141 | }); |
142 | 142 | |
143 | 143 | // if the uploader is a relationship and handles repeatable files, we will also register the deleting event on the |
144 | 144 | // parent model. that way we can control the deletion of the files when the parent model is deleted. |
145 | 145 | if ($uploader->isRelationship() && $uploader->handleRepeatableFiles) { |
146 | - app('crud')->model::deleting(function ($entry) use ($uploader) { |
|
146 | + app('crud')->model::deleting(function($entry) use ($uploader) { |
|
147 | 147 | $uploader->deleteUploadedFiles($entry); |
148 | 148 | }); |
149 | 149 | } |
@@ -165,18 +165,18 @@ discard block |
||
165 | 165 | { |
166 | 166 | $hasCustomUploader = isset($uploaderConfiguration['uploader']); |
167 | 167 | |
168 | - if ($hasCustomUploader && ! is_a($uploaderConfiguration['uploader'], UploaderInterface::class, true)) { |
|
168 | + if ($hasCustomUploader && !is_a($uploaderConfiguration['uploader'], UploaderInterface::class, true)) { |
|
169 | 169 | throw new Exception('Invalid uploader class provided for '.$this->crudObjectType.' type: '.$crudObject['type']); |
170 | 170 | } |
171 | 171 | |
172 | 172 | if ($hasCustomUploader) { |
173 | - return $uploaderConfiguration['uploader']::for($crudObject, $uploaderConfiguration); |
|
173 | + return $uploaderConfiguration['uploader']::for ($crudObject, $uploaderConfiguration); |
|
174 | 174 | } |
175 | 175 | |
176 | 176 | $uploader = app('UploadersRepository')->hasUploadFor($crudObject['type'], $this->macro); |
177 | 177 | |
178 | 178 | if ($uploader) { |
179 | - return app('UploadersRepository')->getUploadFor($crudObject['type'], $this->macro)::for($crudObject, $uploaderConfiguration); |
|
179 | + return app('UploadersRepository')->getUploadFor($crudObject['type'], $this->macro)::for ($crudObject, $uploaderConfiguration); |
|
180 | 180 | } |
181 | 181 | |
182 | 182 | throw new Exception('Undefined upload type for '.$this->crudObjectType.' type: '.$crudObject['type']); |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | |
198 | 198 | private function getSubfieldModel(array $subfield, UploaderInterface $uploader) |
199 | 199 | { |
200 | - if (! $uploader->isRelationship()) { |
|
200 | + if (!$uploader->isRelationship()) { |
|
201 | 201 | return $subfield['baseModel'] ?? get_class(app('crud')->getModel()); |
202 | 202 | } |
203 | 203 | |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | |
211 | 211 | private function getModelForRetrieveEvent(string $model, UploaderInterface $uploader) |
212 | 212 | { |
213 | - if (! $uploader->isRelationship()) { |
|
213 | + if (!$uploader->isRelationship()) { |
|
214 | 214 | return $model; |
215 | 215 | } |
216 | 216 |