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' => [ 'store_id' => [ "type" => 'select', "label" => trans('store::stock.label.store_id'), "placeholder" => trans('store::stock.placeholder.store_id'), "rules" => '', "group" => "main", "section" => "first", "attributes" => [ 'wrapper' => [], "label" => [], "input" => [], ], ], 'product_id' => [ "type" => 'select', "label" => trans('store::stock.label.product_id'), "placeholder" => trans('store::stock.placeholder.product_id'), "rules" => '', "group" => "main", "section" => "first", "attributes" => [ 'wrapper' => [], "label" => [], "input" => [], ], ], 'stock_in' => [ "type" => 'text', "label" => trans('store::stock.label.stock_in'), "placeholder" => trans('store::stock.placeholder.stock_in'), "rules" => '', "group" => "main", "section" => "first", "attributes" => [ 'wrapper' => [], "label" => [], "input" => [], ], ], 'stock_out' => [ "type" => 'text', "label" => trans('store::stock.label.stock_out'), "placeholder" => trans('store::stock.placeholder.stock_out'), "rules" => '', "group" => "main", "section" => "first", "attributes" => [ 'wrapper' => [], "label" => [], "input" => [], ], ], 'price' => [ "type" => 'decimal', "label" => trans('store::stock.label.price'), "placeholder" => trans('store::stock.placeholder.price'), "rules" => '', "group" => "main", "section" => "first", "attributes" => [ 'wrapper' => [], "label" => [], "input" => [], ], ], 'date' => [ "type" => 'date_picker', "label" => trans('store::stock.label.date'), "placeholder" => trans('store::stock.placeholder.date'), "rules" => '', "group" => "main", "section" => "first", "attributes" => [ 'wrapper' => [], "label" => [], "input" => [], ], ], ] ); } }