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' => [ 'restaurant_id' => [ "type" => 'text', "label" => trans('discount::discount.label.restaurant_id'), "placeholder" => trans('discount::discount.placeholder.restaurant_id'), "rules" => 'required', "group" => "main", "section" => "first", "attributes" => [ 'wrapper' => [], "label" => [], "input" => [], ], ], 'menu_id' => [ "type" => 'text', "label" => trans('discount::discount.label.menu_id'), "placeholder" => trans('discount::discount.placeholder.menu_id'), "rules" => 'required', "group" => "main", "section" => "first", "attributes" => [ 'wrapper' => [], "label" => [], "input" => [], ], ], 'discount_percentage' => [ "type" => 'text', "label" => trans('discount::discount.label.discount_percentage'), "placeholder" => trans('discount::discount.placeholder.discount_percentage'), "rules" => 'required', "group" => "main", "section" => "first", "attributes" => [ 'wrapper' => [], "label" => [], "input" => [], ], ], 'active_from' => [ "type" => 'text', "label" => trans('discount::discount.label.active_from'), "placeholder" => trans('discount::discount.placeholder.active_from'), "rules" => 'required', "group" => "main", "section" => "first", "attributes" => [ 'wrapper' => [], "label" => [], "input" => [], ], ], 'active_till' => [ "type" => 'text', "label" => trans('discount::discount.label.active_till'), "placeholder" => trans('discount::discount.placeholder.active_till'), "rules" => 'required', "group" => "main", "section" => "first", "attributes" => [ 'wrapper' => [], "label" => [], "input" => [], ], ], 'edited_at' => [ "type" => 'text', "label" => trans('discount::discount.label.edited_at'), "placeholder" => trans('discount::discount.placeholder.edited_at'), "rules" => '', "group" => "main", "section" => "first", "attributes" => [ 'wrapper' => [], "label" => [], "input" => [], ], ], 'PRIMARY' => [ "type" => 'text', "label" => trans('discount::discount.label.PRIMARY'), "placeholder" => trans('discount::discount.placeholder.PRIMARY'), "rules" => 'required', "group" => "main", "section" => "first", "attributes" => [ 'wrapper' => [], "label" => [], "input" => [], ], ], ] ); } }