2021-09-23 13:35:48 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace App\Http\Requests;
|
|
|
|
|
|
2021-09-24 00:18:02 +02:00
|
|
|
use App\Models\SubRange;
|
|
|
|
|
|
2021-09-23 13:35:48 +02:00
|
|
|
class UpdateSubRange extends StoreSubRange
|
|
|
|
|
{
|
2021-09-24 00:18:02 +02:00
|
|
|
/**
|
|
|
|
|
* 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é");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
]);
|
|
|
|
|
}
|
2021-09-23 13:35:48 +02:00
|
|
|
}
|