Search bar split by comma?

Hey, I’ve kind of made this work already but looking for a better approach maybe? I have a table resource and I would like to search for ids split by comma, So I’m doing something like ->searchable(query: function($query,$search){ return $query->whereIn(id,$search) This works! But I have to pass the ids in a single string without trailing spaces! If I pass on the search bar “1, 2, 3”It doesn’t search! It looks like when adding the space the searchable trait gets called 3 times (I figure this out by dump($search)) and only looks for the last one. I don’t really want to add a filter since we already have the search bar, is there a better approach or a fix to this? Thanks in advance!!
1 Reply
Dhru
Dhru3d ago
I think you can override the getTableSearchQuery() in the list page

Did you find this page helpful?