loading...
Cover image for Laravel validation for translated fields in Fjord.

Laravel validation for translated fields in Fjord.

cbl profile image Lennart Carstens-Behrens ・1 min read

I am currently working on implementing form validation for translatable fields in Fjord. I have thought a lot about how I want to display the names of the attributes.

The integration of the rules is simple. As with non-translatable fields, rules are specified, which are then applied to each language. The example shows how I built the field shown in the title.

$form->input('title')
     ->translatable()
     ->rules('required', 'min:5', 'max:25')
     ->title('Title');

More details about the implementation of field rules for example only for the update or create form can be found in the field validation section of the fjord docs.

It is planned to create rules for individual languages. I'm not quiet sure yet on how the syntax should look like. I was thinking about something like this maybe:

...
->rules('en:required')

Discussion

markdown guide