- How do I add Filament Search Spotlight to my Laravel Filament v3+ panel?
- Install via Composer with `composer require wezlo/filament-search-spotlight`, then register the plugin in your `PanelProvider` using `FilamentSearchSpotlightPlugin::make()`. If using Tailwind, add `@source` to your theme CSS file and rebuild assets. That’s it—press ⌘K (or your configured shortcut) to trigger the search.
- Does this package work with Filament v2?
- The package is officially designed for Filament v3+. While it *might* work with v2, some features (like auto-detection of `getGloballySearchableAttributes()`) may require adjustments. Test thoroughly in a staging environment if attempting to use it with v2.
- Can I customize the search categories (e.g., add a custom 'Reports' category)?
- Yes, you can extend the package by implementing the `Category` contract. The package provides modular categories for records, resources, pages, and actions, so you can replace or add new ones. Check the `SpotlightCategory` interface in the source code for implementation details.
- What happens if two users open the same Filament panel in different browser tabs? Will pinned items sync?
- Pinned items are stored in `localStorage`, which is browser-specific. If two users (or even the same user in multiple tabs) open the panel, their pinned items won’t sync automatically. This is a client-side limitation—consider server-side storage if shared state is critical.
- How do I change the default ⌘K/Ctrl+K keyboard shortcut?
- Use the fluent API to override the binding: `FilamentSearchSpotlightPlugin::make()->keyBinding('ctrl+shift+f')`. You can also pass an array for more complex shortcuts (e.g., `['ctrl+shift', 'f']`). This works globally or per-panel.
- Will this package work if my Filament panel doesn’t use Tailwind CSS?
- The package assumes Tailwind for styling, but you can manually include its CSS by copying the relevant files from `vendor/wezlo/filament-search-spotlight/resources/views` into your project. However, some utility classes may need adjustments if your CSS pipeline doesn’t support Tailwind’s `@source` directive.
- Can I exclude specific resources from the search results?
- Yes, use the `excludeResources()` method in the fluent API: `FilamentSearchSpotlightPlugin::make()->excludeResources(['posts', 'users'])`. You can also configure this in the published config file if you prefer.
- Does Filament Search Spotlight support fuzzy search or advanced matching?
- The package relies on Filament’s built-in `GlobalSearchProvider` for record search, which may not include fuzzy matching by default. For advanced features, you’ll need to create a custom `RecordsCategory` implementation and override the search logic. The package provides hooks for this.
- How do I add custom actions (e.g., 'Clear Cache') to the Spotlight overlay?
- Use the `SpotlightAction` registry via the fluent API: `FilamentSearchSpotlightPlugin::make()->actions([new SpotlightAction('Clear Cache', fn() => Cache::flush())])`. The package auto-generates 'Create {Resource}' actions for resources with a `create` page.
- Is there a way to track user search activity or analytics?
- No, the package stores recent/pinned items in `localStorage` and doesn’t include server-side analytics. If you need tracking, you’d need to implement custom logging (e.g., via JavaScript events or a backend API) and handle it separately.