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() { return [ 'id' => 'required|exists:week_plannings,id', 'day' => 'required|numeric', 'row' => [ 'required', new EnumIsValidRule(TableRow::class) ], 'type' => [ 'required', new EnumIsValidRule(CellType::class) ], 'cellModel' => \sprintf( 'nullable', new EnumIsValidRule(CellModel::class) ), 'foreign' => 'required_with:cellModel|nullable|numeric', 'text' => 'required|string|min:10|max:90' ]; } public function attributes() { return [ 'cellModel' => 'Type d\'élément lié', 'foreign' => 'Élément lié', 'text' => 'Description courte' ]; } }