Skip to main content

FormRequest

Derive Macro FormRequest 

Source
#[derive(FormRequest)]
{
    // Attributes available to this derive:
    #[validate]
}
Expand description

#[derive(FormRequest)], view!, error_view!, and #[derive(Model)] - re-exported here so generated apps depend only on larust-support, not on larust-macros directly. All four macros’ generated code assumes this re-export path (::larust_support::...). #[derive(FormRequest)]: generates an axum::extract::FromRequest impl that validates a form-urlencoded body against each field’s #[validate(...)] rules before the handler runs, returning a 422 with Laravel-shaped field errors on failure (Laravel’s FormRequest).

ⓘ
#[derive(FormRequest)]
pub struct StorePostRequest {
    #[validate(required, length(max = 255))]
    pub title: String,
}