¨4.0.1¨

This commit is contained in:
¨NW¨
2023-12-03 14:07:47 +00:00
parent c08b36d1b6
commit f35052522d
1112 changed files with 43019 additions and 24987 deletions

View File

@@ -15,6 +15,7 @@ class SaveAttributeRequest extends Request
*/
protected $availableAttributes = 'attribute::attributes.attributes';
/**
* Get the validation rules that apply to the request.
*
@@ -30,18 +31,6 @@ class SaveAttributeRequest extends Request
];
}
private function getSlugRules()
{
$rules = $this->route()->getName() === 'admin.attributes.update'
? ['required']
: ['sometimes'];
$slug = Attribute::where('id', $this->id)->value('slug');
$rules[] = Rule::unique('attributes', 'slug')->ignore($slug, 'slug');
return $rules;
}
/**
* Get data to be validated from the request.
@@ -55,16 +44,32 @@ class SaveAttributeRequest extends Request
])->all();
}
private function getSlugRules()
{
$rules = $this->route()->getName() === 'admin.attributes.update'
? ['required']
: ['sometimes'];
$slug = Attribute::where('id', $this->id)->value('slug');
$rules[] = Rule::unique('attributes', 'slug')->ignore($slug, 'slug');
return $rules;
}
/**
* Filter attribute values.
*
* @param array $values
*
* @return array
*/
private function filter($values = [])
{
return array_filter($values, function ($value) {
return ! is_null($value['value']);
return !is_null($value['value']);
});
}
}