is it possible to group select items from query database
is it possible to group select from this
but get the group list from query database like this with category hasmany sub category:
thank you!
but get the group list from query database like this with category hasmany sub category:
thank you!
Solution
Forms\Components\Select::make('payment_type_list_id')
->searchable()
->options(function () {
return PaymentTypeList::with('paymentType')
->get()
->groupBy('paymentType.name')
->mapWithKeys(function ($group, $key) {
return [$key => $group->pluck('name', 'id')];
});
});
probably you can try like this . havent test yet.
->searchable()
->options(function () {
return PaymentTypeList::with('paymentType')
->get()
->groupBy('paymentType.name')
->mapWithKeys(function ($group, $key) {
return [$key => $group->pluck('name', 'id')];
});
});
probably you can try like this . havent test yet.