Skip to content

Commit

Permalink
Add allergens relation to 3.x branch (#978)
Browse files Browse the repository at this point in the history
* Fix #975

* fix missing menu item option values

Signed-off-by: Sam Poyigi <6567634+sampoyigi@users.noreply.github.com>

Co-authored-by: Sam Poyigi <6567634+sampoyigi@users.noreply.github.com>
  • Loading branch information
ryanmitchell and sampoyigi authored May 30, 2022
1 parent b9df4df commit ed16a6d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions app/admin/models/Menu_options_model.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ class Menu_options_model extends Model
],
],
'morphToMany' => [
'allergens' => ['Admin\Models\Allergens_model', 'name' => 'allergenable'],
'locations' => ['Admin\Models\Locations_model', 'name' => 'locationable'],
],
];
Expand Down Expand Up @@ -95,6 +96,7 @@ protected function afterSave()

protected function beforeDelete()
{
$this->allergens()->detach();
$this->locations()->detach();
}

Expand Down
1 change: 1 addition & 0 deletions app/admin/models/config/menu_options_model.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
'values' => [
'label' => 'lang:admin::lang.menu_options.text_tab_values',
'type' => 'repeater',
'valueFrom' => 'option_values',
'form' => 'menu_option_values_model',
'sortable' => true,
],
Expand Down

0 comments on commit ed16a6d

Please sign in to comment.