24
Forms Engine

Form DSL Reference

Code-first builder methods for fields, validation, and file options.

Main builder

  • Form::define('key')
  • ->title('...')
  • ->version('1')
  • ->category('...')
  • ->published(true|false)
  • ->unpublished(true|false)

Field methods

  • text, textarea, email, number
  • select, selectMenu, radio, checkbox, checkboxGroup, switch
  • date, time, datetime, dateRange, datetimeRange
  • file

Common field options

  • required(bool = true)
  • default(mixed)
  • label(string)
  • placeholder(string)
  • helpText(string)
  • rules(string|array ...$rules)
  • replaceRules(string|array ...$rules)
  • meta(array)
  • min(...), max(...), step(...)
  • options(array)
  • multiple(bool = true)
  • disabled(bool = true)

File field options

  • accept(string|array)
  • maxSize(int)
  • maxFiles(int)
  • storageDisk(string)
  • storageDirectory(string)
  • visibility('public'|'private')