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' => [ 'name' => [ "type" => 'text', "label" => trans('discount::discount.label.name'), "placeholder" => trans('discount::discount.placeholder.name'), "rules" => '', "group" => "main", "section" => "first", "attributes" => [ 'wrapper' => [], "label" => [], "input" => [], ], ], 'parent_id' => [ "type" => 'numeric', "label" => trans('discount::discount.label.parent_id'), "placeholder" => trans('discount::discount.placeholder.parent_id'), "rules" => '', "group" => "main", "section" => "first", "attributes" => [ 'wrapper' => [], "label" => [], "input" => [], ], ], 'category_id' => [ "type" => 'numeric', "label" => trans('discount::discount.label.category_id'), "placeholder" => trans('discount::discount.placeholder.category_id'), "rules" => '', "group" => "main", "section" => "first", "attributes" => [ 'wrapper' => [], "label" => [], "input" => [], ], ], 'product_id' => [ "type" => 'numeric', "label" => trans('discount::discount.label.product_id'), "placeholder" => trans('discount::discount.placeholder.product_id'), "rules" => '', "group" => "main", "section" => "first", "attributes" => [ 'wrapper' => [], "label" => [], "input" => [], ], ], 'discount' => [ "type" => 'numeric', "label" => trans('discount::discount.label.discount'), "placeholder" => trans('discount::discount.placeholder.discount'), "rules" => '', "group" => "main", "section" => "first", "attributes" => [ 'wrapper' => [], "label" => [], "input" => [], ], ], 'discount_price' => [ "type" => 'decimal', "label" => trans('discount::discount.label.discount_price'), "placeholder" => trans('discount::discount.placeholder.discount_price'), "rules" => '', "group" => "main", "section" => "first", "attributes" => [ 'wrapper' => [], "label" => [], "input" => [], ], ], 'valid_from' => [ "type" => 'date_time_picker', "label" => trans('discount::discount.label.valid_from'), "placeholder" => trans('discount::discount.placeholder.valid_from'), "rules" => '', "group" => "main", "section" => "first", "attributes" => [ 'wrapper' => [], "label" => [], "input" => [], ], ], 'valid_to' => [ "type" => 'date_time_picker', "label" => trans('discount::discount.label.valid_to'), "placeholder" => trans('discount::discount.placeholder.valid_to'), "rules" => '', "group" => "main", "section" => "first", "attributes" => [ 'wrapper' => [], "label" => [], "input" => [], ], ], ] ); } }