Hey all, I was wondering whether it's possible to pull in a record's columns to use in a filter's options? For example, I have a categories table and a products table and was wondering whether I could pull in the name and ID column from categories into the filter which will be used on products. This was, if someone was to add a new category it would also get added to the filter.
public function options(Request $request)
{
return [
'Hair' => 2,
'Beauty' => 4,
'Nails' => 5,
'Barbers' => 6,
'Brands' => 7,
'Vegan' => 8,
'Electricals' => 166,
'Combos' => 167,
'Starting Kits' => 168
];
}
Here's an example of how I'm doing it currently, by manually adding the categories name and its ID. Whereas I'd want something like a foreach and then use categories->name => categories->id, if possible.