Getting Started
Enable the plugin by adding it to your PanelsProvider's plugin method. You can then register your Spotlight items via ->registerItems(). This can be of type SpotlightProvider, SpotlightQuery or SpotlightResult.
use pxlrbt\FilamentSpotlightPro\SpotlightPlugin;
use pxlrbt\FilamentSpotlightPro\SpotlightProviders\RegisterResources;
$panel->plugins([
SpotlightPlugin::make()->registerItems([
RegisterResources::make(),
YourCustomQuery::make(),
YourCustomCommand::make()
])
])More info on custom queries and commands can be found here:
Auto Discovery
For your convenience Filament Spotlight Pro comes with built-in providers that will automatically register your pages, resources, and some prebuilt commands.
You can use the following providers:
The predefined queries rely on Filaments Global Search so make sure you have at least the $recordTitleAttribute set on your resources.
Configuration
Filament Spotlight Pro offers granular control over which pages, resources, and commands you want to show for every panel. Below is a small example. For more information refer to the docs for the providers.
use pxlrbt\FilamentSpotlightPro\SpotlightPlugin;
use pxlrbt\FilamentSpotlightPro\SpotlightProviders\RegisterPages;
use pxlrbt\FilamentSpotlightPro\SpotlightProviders\RegisterResources;
$panel->plugins([
SpotlightPlugin::make()
->registerItems([
RegisterPages::make()
->fromPanels(['admin', 'menu'])
->except([
Changelog::class
])
RegisterResources::make()
->fromAllPanels(except: ['superadmin'])
->except([
UserResource::class
])
]),
]);Restricting Spotlight Access
You can implement the canAccessSpotlight(Panel $panel) method on your User model to determine if a user can access the Spotlight.
Hotkeys
By default the hotkey to open the Spotlight are ⌘ + K and Ctrl + K to support common windows and macOS behaviour. You can change via the ->hotkeys() method:
SpotlightPlugin::make()->hotkeys(['ctrl.j', 'cmd.j'])