lundi 8 juillet 2019

Laravel pluralization in validation

I'm developing a multilanguage API and I need to return the translated Bag using pluralization.

Examples:

'item' => 'required|min:1' should return

item must have at least 1 character

'item' => 'required|min:2' should return

item must have at least 2 characters

Any idea of how to translate the bag other than iterate the array?

I tried in the lang file:

:attribute must have at least :min character|:attribute must have at least :min characters

and

{1} :attribute must have at least :min character|[2,*] :attribute must have at least :min characters.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire