Support the ongoing development of Laravel.io →
Validation Requests Laravel
Last updated 1 year ago.
0

Hi Bogdan,

At the moment there's no way to write it like that. You could wrap the rules in a variable so you don't need to edit it twice.

$nameRules = 'required|max:255';

$rules = [
    'bride_first_name' => $nameRules,
    'groom_first_name' => $nameRules,
];
Last updated 6 years ago.
0

Or you could create a custom rule that says 'required_and_max_255' if you need this combination a lot.

0

Thank you very much guys for your answers. I'll go with a custom validation rule for this.

0

Sign in to participate in this thread!

Eventy

Your banner here too?

Bogdan P. melokki Joined 26 Jun 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.