Global Search Hooks

Hi all, Is there a way to "hook" searches? I want to transform some of the data before it hits the models for searching. As in, the user will be able to write their own query (e.g. `post:"example-post" AND hits:1337)). I'm going to transform that back to SQL using an API call. So I guess the question here is, is there a way to "intercept" searches?
4 Replies
Lloyd
LloydOP5w ago
Thank you @awcodes, how can I access the actual search content here though? (i.e. the content input to the search box) - as I’ll need to transform it to a query
awcodes
awcodes5w ago
My recommendation would be to do some source diving and understanding how it all works. Unfortunately there’s not going to be an easy answer for your use case. I was just trying to point out that over ridding the query is possible with that method.
Lloyd
LloydOP5w ago
Thanks again! Looking at the source code, it looks like this method can accept $search which may be what I'm looking for - https://github.com/filamentphp/filament/blob/3.x/packages/panels/src/Resources/Resource.php#L448
GitHub
filament/packages/panels/src/Resources/Resource.php at 3.x · filame...
A collection of beautiful full-stack components for Laravel. The perfect starting point for your next app. Using Livewire, Alpine.js and Tailwind CSS. - filamentphp/filament
Want results from more Discord servers?
Add your server