Merge pull request #2896 from novag/form-group-tax

form.group.tax: default to displaying title instead of name
This commit is contained in:
Cüneyt Şentürk 2023-02-21 19:45:15 +03:00 committed by GitHub
commit 28348ac8e5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -30,10 +30,10 @@ class Tax extends Form
$this->field = [
'key' => 'id',
'value' => 'name'
'value' => 'title'
];
$this->taxes = Model::enabled()->orderBy('name')->pluck('name', 'id');
$this->taxes = Model::enabled()->orderBy('name')->get()->pluck('title', 'id');
$tax_id = old('tax.id', old('tax_id', null));
@ -43,7 +43,7 @@ class Tax extends Form
if (! $this->taxes->has($tax_id)) {
$tax = Model::find($tax_id);
$this->taxes->put($tax->id, $tax->name);
$this->taxes->put($tax->id, $tax->title);
}
}