Open pktharindu opened 5 years ago
I'm trying to use the included Checkboxes field in another nova resource and I can't figure out how the options should be passed. Currently, my field looks like something like this which doesn't work:
Checkboxes
Checkboxes::make(__('Foods'), 'foods') ->withGroups() ->options(collect(config('foods'))->map(function ($food, $key) { return [ 'group' => ucfirst($food['group']), 'option' => $key, 'label' => $food['name'], ]; })->groupBy('group')->toArray()),
My config file looks something like this:
<?php return [ 'apple' => [ 'name' => 'Apple', 'group' => 'Fruit', ], 'orange' => [ 'name' => 'Orange', 'group' => 'Fruit', ], ... ];
Can you please show me how I should structure the config file and/or fields options to make this work?
I'm trying to use the included
Checkboxes
field in another nova resource and I can't figure out how the options should be passed. Currently, my field looks like something like this which doesn't work:My config file looks something like this:
Can you please show me how I should structure the config file and/or fields options to make this work?