@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | if ($object->$group) { |
| 39 | 39 | $decoded_fields = json_decode($object->$group, true); |
| 40 | 40 | // In case that some field read the value through $item->$name |
| 41 | - foreach($decoded_fields as $field_name => $field_value) { |
|
| 41 | + foreach ($decoded_fields as $field_name => $field_value) { |
|
| 42 | 42 | $object->setAttribute($field_name, $field_value); |
| 43 | 43 | } |
| 44 | 44 | $fields = array_merge($fields, $decoded_fields); |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | |
| 51 | 51 | protected function handleFieldsGroups($fields) { |
| 52 | 52 | foreach ($this->fieldsGroups as $group => $groupFields) { |
| 53 | - $fields[$group] = Arr::where(Arr::only($fields, $groupFields), function ($value, $key) { |
|
| 53 | + $fields[$group] = Arr::where(Arr::only($fields, $groupFields), function($value, $key) { |
|
| 54 | 54 | return !empty($value); |
| 55 | 55 | }); |
| 56 | 56 | Arr::forget($fields, $groupFields); |
@@ -15,23 +15,23 @@ |
||
| 15 | 15 | */ |
| 16 | 16 | public function boot() |
| 17 | 17 | { |
| 18 | - Validator::extend('absolute_or_relative_url', function ($attribute, $value, $parameters, $validator) { |
|
| 18 | + Validator::extend('absolute_or_relative_url', function($attribute, $value, $parameters, $validator) { |
|
| 19 | 19 | return starts_with($value, '/') || Validator::make([$attribute => $value], [$attribute => 'url'])->passes(); |
| 20 | 20 | }, 'The :attribute should be a valid url (absolute or relative)'); |
| 21 | 21 | |
| 22 | - Validator::extend('relative_or_secure_url', function ($attribute, $value, $parameters) { |
|
| 22 | + Validator::extend('relative_or_secure_url', function($attribute, $value, $parameters) { |
|
| 23 | 23 | return starts_with($value, '/') || filter_var($value, FILTER_VALIDATE_URL) !== false && starts_with($value, 'https'); |
| 24 | 24 | }, 'The :attribute should be a valid url (relative or https)'); |
| 25 | 25 | |
| 26 | - Validator::extend('web_color', function ($attribute, $value, $parameters, $validator) { |
|
| 26 | + Validator::extend('web_color', function($attribute, $value, $parameters, $validator) { |
|
| 27 | 27 | return preg_match('/^([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/i', $value); |
| 28 | 28 | }); |
| 29 | 29 | |
| 30 | - Validator::extend('phone_number', function ($attribute, $value, $parameters) { |
|
| 30 | + Validator::extend('phone_number', function($attribute, $value, $parameters) { |
|
| 31 | 31 | return preg_match("/^[+]?[0-9\-\ ]*$/", $value); |
| 32 | 32 | }); |
| 33 | 33 | |
| 34 | - Validator::extend('validBlocks', function ($attribute, $value, $parameters, $validator) { |
|
| 34 | + Validator::extend('validBlocks', function($attribute, $value, $parameters, $validator) { |
|
| 35 | 35 | foreach ($value as $block) { |
| 36 | 36 | $cmsBlock = $this->app->make(BlockRepository::class)->buildFromCmsArray($block, false); |
| 37 | 37 | |