Validation

Learn how to apply validation rules in your CRUD

Inside the Optional Details section for each row of your CRUD, you can also validation rules using some simple JSON. The following is an example of how to add a validation required and a maximum length of 20

{
    "validation": {
        "rule": "required|max:20"
    }
}

You can add some error messages that can be performed as follows:

{
    "validation": {
        "rule": "required|max:20",
        "messages": {
            "required": "The :attribute field is required.",
            "max": "The :attribute field maximum :max."
        }
    }
}

You can also specify the validation rules as an array instead of using the | :

{
    "validation": {
        "rules": [
            "required",
            "max:20"
        ]
    }
}

More information about the validation can be found at https://laravel.com/docs/validation.


What’s Next