show selected category on category component

This commit is contained in:
mehmetcoban
2022-06-06 14:17:47 +03:00
parent 4f37973e57
commit b289a15aa1

View File

@ -37,6 +37,10 @@ class Category extends Form
$this->categories->put($model->category->id, $model->category->name); $this->categories->put($model->category->id, $model->category->name);
} }
if($model = $this->getParentData('model')) {
$this->selected = $model->category_id;
}
if (empty($this->selected) && (in_array($type, ['income', 'expense']))) { if (empty($this->selected) && (in_array($type, ['income', 'expense']))) {
$this->selected = setting('default.' . $type . '_category'); $this->selected = setting('default.' . $type . '_category');
} }