Validate value field from a nested form

I’m working with a nested form in the backend

name: 
    label: Name
    type: text
    span: auto
age:
    label: Age
    type: number
    span: auto
driver:
    type: nestedform
    form:
        fields:
            title:
                label: Text field
                type: text
                span: auto
            items:
                label: Items
                type: number

And I can validate the name and age fields in the model

   /**
     * @var array rules for validation
     */
    public $rules = [
        'name' => 'required',
        'age' => 'numeric',
    ];

But the question is: ¿How can I validate the title and items field from the nested form in the model? ¿It’s possible?

Thanks in advance

   /**
     * @var array rules for validation
     */
    public $rules = [
        'name' => 'required',
        'age' => 'numeric',
        'driver.*.title' => 'required',
        'driver.*.items' => 'required',
    ];

I found it

   /**
     * @var array rules for validation
     */
    public $rules = [
        'name' => 'required',
        'age' => 'integer',
        'driver[title]' => 'required',
        'driver[items]' => 'required|integer',
    ];
1 Like