ldc-legaulois/app/Http/Requests/UpdateSubRange.php

29 lines
757 B
PHP
Raw Normal View History

2021-09-23 13:35:48 +02:00
<?php
namespace App\Http\Requests;
use App\Models\SubRange;
2021-09-23 13:35:48 +02:00
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é");
}
}
]
]);
}
2021-09-23 13:35:48 +02:00
}