I have a CustomFormRequest in which I want to use a custom rule. This is the rules() method in the FormRequest.
public function rules()
{
return [
'name' => 'customrule'
];
}
The Validorclass
class CustomValidator extends Illuminate\Validation\Validator{
protected function customrule( $attribute, $value ) {
return false;
}
I have a CustomServiceProvider with the following boot() method
public function boot()
{
\Validator::resolver(function($translator, $data, $rules, $messages)
{
return new CustomValidator($translator, $data, $rules, $messages);
});
}
The CustomServiceProvider is listed in the app.php file.
Controller hat is using the formrequest
public function store(CustomFormRequest $request)
{
$input = $request->all();
dd("request succeeded");
This rule is not recognized by my FormRequest (or at least not executed), since the request always succeeds. How can I fix this?