name)) { $this->name = 'tax_id'; } $this->path = route('modals.taxes.create'); $this->field = [ 'key' => 'id', 'value' => 'title' ]; $this->taxes = Model::enabled()->orderBy('name')->get()->pluck('title', 'id'); $tax_id = old('tax.id', old('tax_id', null)); if (! empty($tax_id)) { $this->selected = $tax_id; if (! $this->taxes->has($tax_id)) { $tax = Model::find($tax_id); $this->taxes->put($tax->id, $tax->title); } } if (empty($this->selected) && empty($this->getParentData('model'))) { $this->selected = setting('default.tax'); } return view('components.form.group.tax'); } }