add subranges system add SubRanges Component add Subranges add on BO Product.edit add Subrange filter on products.index
28 lines
757 B
PHP
28 lines
757 B
PHP
<?php
|
|
|
|
namespace App\Http\Requests;
|
|
|
|
use App\Models\SubRange;
|
|
|
|
class UpdateSubRange extends StoreSubRange
|
|
{
|
|
/**
|
|
* Get the validation rules that apply to the request.
|
|
*
|
|
* @return array
|
|
*/
|
|
public function rules()
|
|
{
|
|
return \array_merge(parent::rules(), [
|
|
'slug' => [
|
|
'required',
|
|
//phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClassBeforeLastUsed
|
|
function ($attribute, $value, $fail) {
|
|
if ($this->subrange->slug !== $value and SubRange::where('slug', $value)->exists()) {
|
|
$fail("Le champ Nom est déjà utilisé");
|
|
}
|
|
}
|
|
]
|
|
]);
|
|
}
|
|
}
|