file-dashed-lineForm Request

Sketch automatically generates form request classes to handle validation for your models. These request classes are generated based on your YAML schema definition and follow Laravel's form request validation patterns.

Generated Structure

app/Http/Requests/
└── Post/
    ├── PostCreateRequest.php
    └── PostUpdateRequest.php

Field Validation

The validation rules are automatically generated based on your field definitions in the YAML schema. Here's how different field types are validated:

Basic Fields

fields:
    - name: title
      type: string
      nullable: false

This generates the following validation rules:

public function rules(): array
{
    return [
        'title' => ['required', 'string', 'max:255']
    ];
}

Enum Fields

Generates:

Relationship Validation

For relationships, Sketch generates appropriate existence validation rules:

Generates:

Belongs to Many Relationship Validation

For many-to-many relationships with pivot data:

Generates:

Last updated