Validation

Any fields that are displayed on the Lamotivo creation or update forms will need some validation. Lamotivo uses the internal Laravel validation rules.

Attaching Rules

When defining a field on a resource, you may use the rules method to attach validation rules to the field:

Text::make('name')
    ->rules('required'),

Custom Error Messages

Lamotivo uses the default error messages for validation. If you need, you may the messages method to define custom error messages:

Text::make('name')
    ->rules('required')
    ->messages([
        'required' => 'You should provide a value',
    ]),