How to use morphable multiple select that related together(like choose two category and then choose some sub category of them) In Subfields? #478
Replies: 1 comment
-
I see this didn't get answered. In the future @rainbow1997 please make it easier for people to help you out - be clear what you want to achieve, what happens when you try it and what solutions you've already tried. In the post above... I don't understand what I can do to help? I can't copy-paste your code because I don't have the models. I don't know what is working and what's not working... I don't understand anything... so I can't help. What exactly is your expectation here - how can someone help? That's my thought process reading your post and I'm sure it would be the same for others... which is probably why this didn't get any answers. Sorry for commenting on form without providing any solution, writing is something I'm passionate about 😀 Hope it helps you get better answers in the future. Cheers! |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I have a problem to use morphable related selects in subfields of laravel backpack. Actually, How can I use this code in backpack subfields?
CRUD::field('colorable')
->label(trans('translate.to'))
->addMorphOption('App\Models\PlexiColor', trans("translate.plexi_color"), [
'type' => 'select2_from_ajax',
'attribute' => "name",
'entity' => 'colorable',
'model' => "App\Models\PlexiColor",
'data_source' => backpack_url('board-color-price/fetch/plexi-color'),
'minimum_input_length' => 0,
'method' => 'POST',
'include_all_form_fields' => true,
])
->addMorphOption('App\Models\MultiStyleColor', trans("translate.multistyle_colors"), [
'type' => 'select2_from_ajax',
'attribute' => "name",
'entity' => 'colorable',
'model' => "App\Models\MultiStyleColor",
'data_source' => backpack_url('board-color-price/fetch/multistyle-color'),
'minimum_input_length' => 0,
'method' => 'POST',
'include_all_form_fields' => true,
])
->addMorphOption('App\Models\StealColor', trans("translate.steal_colors"), [
'type' => 'select2_from_ajax',
'attribute' => "name",
'entity' => 'colorable',
'model' => "App\Models\StealColor",
'data_source' => backpack_url('board-color-price/fetch/steal-color'),
'minimum_input_length' => 0,
'method' => 'POST',
'include_all_form_fields' => true,
])
->addMorphOption('App\Models\PleximirrorColor', trans("translate.Pleximirror_colors"), [
'type' => 'select2_from_ajax',
'attribute' => "name",
'entity' => 'colorable',
'model' => "App\Models\PleximirrorColor",
'data_source' => backpack_url('board-color-price/fetch/pleximirror-colors'),
'minimum_input_length' => 0,
'method' => 'POST',
'include_all_form_fields' => true,
])
->morphTypeField(['wrapper' => ['class' => 'form-group col-md-6']])
->morphIdField(['wrapper' => ['class' => 'form-group col-md-6'], 'placeholder' => trans('translate.choose'),]);
I did many things but it doesn't work! for example: I use addMorphOption like array in subfield but it doesn't work.
Beta Was this translation helpful? Give feedback.
All reactions