check if model has category/contact property #2568
This commit is contained in:
parent
2a1d61ff84
commit
1dd103d155
@ -33,7 +33,7 @@ class Category extends Form
|
||||
|
||||
$model = $this->getParentData('model');
|
||||
|
||||
if (! empty($model)) {
|
||||
if (! empty($model) && ! empty($model->category_id)) {
|
||||
$this->selected = $model->category_id;
|
||||
|
||||
$selected_category = $model->category;
|
||||
|
@ -39,12 +39,14 @@ class Contact extends Form
|
||||
|
||||
$model = $this->getParentData('model');
|
||||
|
||||
if (! empty($model)) {
|
||||
if (! empty($model) && ! empty($model->contact_id)) {
|
||||
$this->selected = $model->contact_id;
|
||||
|
||||
if (! $this->contacts->has($model->contact_id) && ($contact = $model->contact)) {
|
||||
$this->contacts->put($contact->id, $contact->name);
|
||||
}
|
||||
$selected_contact = $model->contact;
|
||||
}
|
||||
|
||||
if (! empty($selected_contact) && ! $this->contacts->has($selected_contact->id)) {
|
||||
$this->contacts->put($selected_contact->id, $selected_contact->name);
|
||||
}
|
||||
|
||||
return view($this->view);
|
||||
|
Loading…
x
Reference in New Issue
Block a user