From ed16a6d300214c92e4354d69dae717015528a580 Mon Sep 17 00:00:00 2001 From: Ryan Mitchell Date: Mon, 30 May 2022 13:22:15 +0100 Subject: [PATCH] Add allergens relation to 3.x branch (#978) * 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> --- app/admin/models/Menu_options_model.php | 2 ++ app/admin/models/config/menu_options_model.php | 1 + 2 files changed, 3 insertions(+) diff --git a/app/admin/models/Menu_options_model.php b/app/admin/models/Menu_options_model.php index 4caec90ea7..ffb78847eb 100644 --- a/app/admin/models/Menu_options_model.php +++ b/app/admin/models/Menu_options_model.php @@ -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'], ], ]; @@ -95,6 +96,7 @@ protected function afterSave() protected function beforeDelete() { + $this->allergens()->detach(); $this->locations()->detach(); } diff --git a/app/admin/models/config/menu_options_model.php b/app/admin/models/config/menu_options_model.php index fd0e1e17d6..5e7f973614 100644 --- a/app/admin/models/config/menu_options_model.php +++ b/app/admin/models/config/menu_options_model.php @@ -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, ],