Because I just came across it in the application again, this is the output I get when just viewing it (not editing): [object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Apr 16, 2022
2
Level 1
Laravel Nova - Populate options of a multiselect
Hi all,
I am trying to populate options for a MultiSelect in Laravel Nova (4.~) using the following code:
MultiSelect::make('Rights')
->options(function() {
$rights = \App\Models\Right::all();
$options = [];
foreach($rights as $right) {
$options[$right->id] = $right->name;
}
return $options;
})
->displayUsingLabels(),
When trying it, Nova returns me "Array to string conversion" and "There was a problem submitting the form". Any ideas on how to solve it? I try to have all $right-name (s) in the options array as I do not know how to do it differently.
Thank you!
Please or to participate in this conversation.