setForm(); } /** * Return form elements. * * @return array. */ public function form($element = 'fields', $grouped = true) { $item = collect($this->form->get($element)); if ($element == 'fields' && $grouped == true) { return $item->groupBy(['group', 'section']); } return $item; } /** * Sets the form and form elements. * @return null. */ public function setForm() { $this->form = collect([ 'form' => [ 'store' => [], 'update' => [], ], 'groups' => [ 'main' => 'Main', ], 'fields' => [ 'data' => [ "type" => 'text', "label" => trans('voucher::voucher.label.data'), "placeholder" => trans('voucher::voucher.placeholder.data'), "rules" => '', "group" => "main", "section" => "first", "attributes" => [ 'wrapper' => [], "label" => [], "input" => [], ], ], 'redeem' => [ "type" => 'decimal', "label" => trans('voucher::voucher.label.redeem'), "placeholder" => trans('voucher::voucher.placeholder.redeem'), "rules" => '', "group" => "main", "section" => "first", "attributes" => [ 'wrapper' => [], "label" => [], "input" => [], ], ], 'model_type' => [ "type" => 'text', "label" => trans('voucher::voucher.label.model_type'), "placeholder" => trans('voucher::voucher.placeholder.model_type'), "rules" => '', "group" => "main", "section" => "first", "attributes" => [ 'wrapper' => [], "label" => [], "input" => [], ], ], 'model_id' => [ "type" => 'numeric', "label" => trans('voucher::voucher.label.model_id'), "placeholder" => trans('voucher::voucher.placeholder.model_id'), "rules" => '', "group" => "main", "section" => "first", "attributes" => [ 'wrapper' => [], "label" => [], "input" => [], ], ], 'expire_at' => [ "type" => 'date_time_picker', "label" => trans('voucher::voucher.label.expire_at'), "placeholder" => trans('voucher::voucher.placeholder.expire_at'), "rules" => '', "group" => "main", "section" => "first", "attributes" => [ 'wrapper' => [], "label" => [], "input" => [], ], ], 'PRIMARY' => [ "type" => 'package::package.formcontrols.KEY', "label" => trans('voucher::voucher.label.PRIMARY'), "placeholder" => trans('voucher::voucher.placeholder.PRIMARY'), "rules" => '', "group" => "main", "section" => "first", "attributes" => [ 'wrapper' => [], "label" => [], "input" => [], ], ], ] ); } }