F
Filamentβ€’3mo ago
joao nivaldo

Create a global search

Guys, what would be the best approach for me to take for the following resource. I need to create a screen for a global search. In the textobox I will enter the term and it will search in several models. The result must be grouped by model and must be displayed in a table. How should I do this? Thanks
10 Replies
krekas
krekasβ€’3mo ago
Why do you need it in a resource? What's wrong with the global search at the top nav?
joao nivaldo
joao nivaldoβ€’3mo ago
There is no way to search the table globally, as I will check several models and then return a result grouped by model. I think that in the global search of the table this cannot be done, if it is possible and you can show me how I appreciate it.
krekas
krekasβ€’3mo ago
can't you use this?
joao nivaldo
joao nivaldoβ€’3mo ago
So from what I saw, I can only use a Model with several relationships for this global search. And actually I need to search, for example, in the table, users, products, categories, blog, etc. And then return the result grouped by model.
krekas
krekasβ€’3mo ago
check the demo app isn't like that you want?
joao nivaldo
joao nivaldoβ€’3mo ago
According to the demo application, this would be the case. But I didn't understand how to do this from the documentation in the link you gave me. She only cites a record with several relationships. Or when I use this global search, does it already get all the columns that are marked for searches in the resource tables? Another thing, is there any way I can show the search results in a table and not in a dropdown? I've now read the documentation you gave me and I think I understand. I apologize for my questions. So I had 2 doubts. How do I disable a resource where I don't want it to be seen by global search and how can I show the result in a table, for example, or in another custom layout instead of the dropdown?
blntgvn42
blntgvn42β€’3mo ago
in your resource, just put;
public static function getGloballySearchableAttributes(): array
{
return [];
}
public static function getGloballySearchableAttributes(): array
{
return [];
}
This disables global search for resource. However, I dont have any idea about custom layout πŸ™‚
joao nivaldo
joao nivaldoβ€’3mo ago
Thanks for your help.
Dennis Koch
Dennis Kochβ€’3mo ago
I guess you could build your own page and just pass the search to the global search class and render the results yourself
Want results from more Discord servers?
Add your server
More Posts
How can I add a ImportAction in an Action with Stepers?I want to be able to select some options before importing. Any alternative works for meTesting action errorHello and thanks for anyone that helps me. So I have a list page were i have a custom action ```ActCall the "edit" modal for a record in a resource from a different pageHi everyone. I have a "Reservation" Resource (and Model) that I use in a custom Livewire component tChange default table query to get only the soft deleted recordsHello all, For a project im working on I need my table results to only show the soft deleted recordsTailwind Issues even with Custom ThemeHi, I'm having some issues with tailwind where certain classes are not being picked up. I've setup Hello, how do I make Relation Manager form use full width of the page please?Hello, I am using Relation Manager to add records. I need to display the form modal in full width, pThe default value is not set in the select field with any nameThe default value is not set in the select field with any name when editing a record. I need to addthere seems to be no difference when using disabled vs visible in actionIt seems that using the visible method on an Action just disables the action, it doesn't actually hiFilament v2 Wizard Step mandatoryI have a step where the inputs are not required. But the step itself must be viewed before submittinNext step with pressing enter instead of submitting.I have a Wizzard with several steps. When I press enter inside the wizzard it submits the whole thin