Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

murilo's avatar
Level 10

Laravel Many Custom Requests

Hello Guys , I usaly make custom laravel request like this -

THIS way it works 

public function rules()
    {
        return [
            'email'                => ['required'  , new VerifyIfThisEmailDoesNotExist()] ,
            'name'              => 'required'
        ];
    }

But I am trying to use many custom classes in just one field , and it is not working . like this -

THIS way dont works 

public function rules()
    {
        return [
            'email'                => ['required'  , new VerifyIfThisEmailDoesNotExist() , new VerifyIfThisEmailisGmailAccount( ) , ] ,
            'name'              => 'required'
        ];
    }

It is only possible to use one custome class for fields ?

0 likes
2 replies
JohnBraun's avatar
Level 33

You should be able to pass in multiple custom validation rules.

Do they work separately from each other, when you use them one at a time? In other words: is VerifyIfThisEmailisGmailAccount() working properly?

I also see you have a space passed as an argument to VerifyIfThisEmailisGmailAccount() in the code you posted on the forum. Now this could be a typo while copy/pasting but just to be sure.

murilo's avatar
Level 10

I wold like to make separated , if I make togueder , It works . but separated . I does not works .

Please or to participate in this conversation.