الصفحات · Laravilt
Forms FAQ
Questions about form fields, validation and reactive fields.
How do I define a resource form?
Resource forms are a Schema. The generator creates a {Model}Form class:
php
How do I add validation rules?
php
->rules() accepts a string, an array, or a closure that returns rules. Any Laravel rule works, including rule objects. See Validation.
How do I create dependent fields?
Mark the parent ->live() and read its value with Get:
php
See Reactive Fields.
How do I show or hide a field conditionally?
php
How do I handle file uploads?
php
See Media Fields.
Can I build my own field type?
Yes: php artisan make:form-component ColorSwatch --vue (or --react) scaffolds the PHP field class and its frontend component.