ryanmitchell Can you give me advise again, I managed to get my extra tab to work and pull data as checkboxlist like that:
Event::listen('admin.form.extendFields', function (Form $form) {
if (!$form->model instanceof Menus_model) return;
$form->addTabFields([
'extra_options' => [
'label' => 'Extra options',
'tab' => 'Extra options',
'type' => 'checkboxlist',
'options' => ['Igniter\Extraoptions\Models\Menu_extraoptions_model', 'listExtraOptions'],
'commentAbove' => 'Check an extra option',
'placeholder' => 'Check extra option which should be shown for the menu',
'context' => ['edit', 'preview'],
],
]);
});
However now i can’t save the menu item since the Save button throws error. I think my problem is that the system tries to put the extra checkboxes values in the menu item db table, my idea is to have relation table with two columns - menu_id and option_id and when menu item is saved each of extra checkboxes value to be put in this table in option_id column with edited menu id in menu_id column. That way, latter i can pull the data for given menu_id joined with option table data on option_id and display all option names for given menu item.
This is my DB structure:
Schema::create('igniter_extraoptions', function (Blueprint $table) {
$table->engine = 'InnoDB';
$table->integer('option_id', TRUE);
$table->string('title');
});
Schema::create('igniter_options_menu_items', function (Blueprint $table) {
$table->engine = 'InnoDB';
$table->integer('menu_id');
$table->integer('option_id');
$table->primary(['menu_id', 'allergen_id']);
});
I looked at current menu options code, but is too complicated for what I’m trying to achieve