srinivas214 - 4 months ago

Hi, I have table with cities (id, city name) and would like to render the cities in the below mentioned filter options by querying from the database instead of the static options. Please help me to fix this

'city' => [ 'filter' => 'select', 'options' => [ 'live' => 'Live', 'draft' => 'Draft', 'scheduled' => 'Scheduled', ], ],

ryanthompson - 4 months ago

For the custom select FT you should just be able to make your options parameter a handler:

'options' => MyOptions::class . '@handle',

FilterInterface $filter will be available for method/class injection there:

public function handle(FilterInterface $filter, SomeRepositoryInterface $widgets) {
    return $widgets->all()->pluck('id', 'name');

^ Is close to a valid example I think lol

vargvinter - 2 months ago

@ryanthompson I need this functionality too, but your sollution does not work. It just returns string 'MyOptions::class@handle' in select dropdown.