check(); } /** * Prepare the data for validation. * * @return void */ protected function prepareForValidation() { $this->merge([ 'new_tab' => $this->new_tab ? true : false, 'status' => $this->status ? true : false, ]); } /** * Get the validation rules that apply to the request. * * @return array */ public function rules(): array { return [ 'title' => 'required', 'picture' => 'sometimes|image|mimes:jpeg,png,jpg|max:2048|dimensions:width=1920,height=878', 'alt_text_picture' => 'required|max:255', 'url' => 'nullable|required_if:new_tab,true|url', 'new_tab' => 'required_with:url|boolean', 'status' => 'nullable|boolean' ]; } }