TALL-forms
  • TALL-forms
  • Installation
    • Quickstart: Artisan cmd
    • Manual installation
      • Package
      • Translations
      • Css & Theme
      • Javascript
      • Tailwind
      • Laravel Mix
      • Wrapper view
      • Laravel Jetstream/Breeze
  • Upgrade v7 to v8
    • Configuration changes
    • Component & Field changes
    • Blade view changes
    • Notification changes
    • Styling changes
  • Concept
    • Configuration
    • Validation
    • Styling
    • Icons
    • Javascript
    • Layout vs Wrapper
    • Model binding
    • Manually saving data
    • Extend Blade Components
  • Create Forms
    • Form Data
    • Form Types
      • Standard form
      • As modal
      • Without buttons
      • Fields only
      • Headless
    • Form attributes
    • Form buttons
    • Form slots
    • Form methods
    • Lifecycle hooks
    • Render a form
    • Mass generate
  • Fields
    • Declaration
    • Labels
    • Field Slots
    • Field methods
    • Custom field attributes
    • Conditional field
    • Custom view
    • Custom field
    • Custom Livewire component
    • Relations
    • Fields
      • Checkbox
      • Checkboxes
      • FileUpload
      • Honeypot
      • ImageCropper
      • Input
      • Password
      • InputArray
      • KeyVal (array)
      • Radio
      • Range
      • Repeater (array)
      • Search
      • Select & Multiselect
      • Tags
      • TagsSearch
      • Textarea
      • Trix
      • SpatieTags
    • Sponsor Fields
      • More Inputs
      • CKEditor
      • DatePicker
      • Heading
      • Markdown
      • Panels
      • SearchList
      • SelectOptGroup
      • Tabs
      • Trix, file-uploads
  • Blade components
    • Notifications
    • Label wrapper
    • Button
    • Modal blade component
    • Modal form blade component
  • Examples
    • Input examples
    • Array fields example
Powered by GitBook
On this page

Was this helpful?

  1. Examples

Array fields example

protected function fields()
{
 return [
    Keyval::make(trans('fields.settings').' '.trans('fields.upfront'), 'upfronts')->fields([
        Checkbox::make(trans('fields.upfront_auto'), 'auto')
            ->placeholder(trans('fields.auto'))
            ->help(trans('fields.upfront_auto_hint'))
            ->rules('required|boolean')
            ->colspan(12),
        Input::make(trans('fields.amount'), 'amount')
            ->type('number')
            ->prefix('kr')
            ->placeholder(300)
            ->help(trans('fields.upfront_amount_hint'))
            ->rules('nullable|numeric|integer|min:10')
            ->colspan(6),
        Input::make(trans('fields.percent'),'amount_percent')
            ->type('number')
            ->prefix('%')
            ->placeholder(50)
            ->help(trans('fields.percent_hint') . ' ' . trans('fields.upfront_percent_hint'))
            ->rules('nullable|numeric|integer|between:1,100')
            ->colspan(6),
    ])->help(trans('fields.upfront_help')),
    
    KeyVal::make('Bio')->fields([
        Input::make('Profession')->colspan(6)->help('Field help')->rules('required'),
        Input::make('Spouse')->colspan(6)->rules('required'),
        Input::make('Pet')->colspan(6)->help('Field help')->rules('required'),
        Input::make('Children')->colspan(6)->rules('required'),
    ]),
    
    Repeater::make('Friends')->fields([
        Input::make('First name')
            ->afterLabel('After Label slot')
            ->rules('required')
            ->colspan(6),
        Input::make('Last name')
            ->afterLabel('Best slot to display field help')
            ->colspan(6)
            ->rules('required'),
    ])->sortable()
    ->help('Click plus to add a friend'),
 ];
}
PreviousInput examples

Last updated 3 years ago

Was this helpful?