merge([ 'model' => $this->model ?? null, 'foreign' => $this->foreign ?? null, 'text' => $this->text ?? '' ]); return auth()->check() and $this->ajax(); } /** * Get the validation rules that apply to the request. * * @return array */ public function rules(): array { return [ 'id' => 'required|exists:week_plannings,id', 'day' => 'required|numeric', 'row' => [ 'required', new Enum(TableRowEnum::class) ], 'type' => [ 'required', new Enum(CellTypeEnum::class) ], 'CellModelEnum' => \sprintf( 'nullable', new Enum(CellModelEnum::class) ), 'foreign' => 'required_with:CellModelEnum|nullable|numeric', 'text' => 'required|string|min:5|max:90' ]; } /** * Get custom attributes for validator errors. * * @return array */ public function attributes(): array { return [ 'CellModelEnum' => 'Type d\'élément lié', 'foreign' => 'Élément lié', 'text' => 'Description courte' ]; } }