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'),
];
}
Last updated
Was this helpful?