SelectFilter doesn't working
I have a table named 'clothes' and a column named 'mark', so i can't figure it out why it's not working. I don't know if I should use relationship, a query, if I should create an enum, 'cause Mark won't never change, I'm very confused, still learning
Solution:Jump to solution
I solved the problem!
I only add a ->relationship('clothes', 'mark') and it worked...
3 Replies
The name passed to make() should be the column name. See below in the docs. Also, options() expects an array, so if you have an enum you may need a method to convert the cases like this:
public static function filterOptions(): array {
return array_column(self::cases(), "value", "name");
}
"Select filters do not require a custom query() method. The column name used to scope the query is the name of the filter. To customize this, you may use the attribute() method:"
I did like this, did I make it right as you said?
Still don't filtering
Solution
I solved the problem!
I only add a ->relationship('clothes', 'mark') and it worked