"required|string|min:2", "email" => "required|email|max:255", "comment" => "required|min:2", "post_id" => "required|exists:posts,id" ]; } public function failedValidation(Validator $validator) { if($validator->fails()) { return [ "type" => "alert-danger", "message" => "Please check the input fields" ]; } } }