ldc-legaulois/app/Http/Requests/UpdateSubRange.php
Jérémy Munsch f39f990748
npm i vue-nestable --save-dev
add subranges system
add SubRanges Component
add Subranges add on BO Product.edit
add Subrange filter on products.index
2021-09-24 00:18:02 +02:00

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é");
}
}
]
]);
}
}