Skip to content

Register Pages

Use the RegisterPages provider to automatically register all your non-resource pages.

php
use pxlrbt\FilamentSpotlightPro\SpotlightPlugin;
use pxlrbt\FilamentSpotlightPro\SpotlightProviders\RegisterPages;

$panel->plugins([
    SpotlightPlugin::make()->registerItems([
        RegisterPages::make()
    ])
])

Excluding Pages

You can exclude pages by passing an array of page classes to the ->except(). method.

php
SpotlightPlugin::make()->registerItems([
    RegisterPages::make()->except([
        Dashboard::class
    ])
])

You can also exclude pages by adding the static shouldRegisterSpotlight() method to your Page class and return false.

php
class Dashboard extends Page
{
    public static function shouldRegisterSpotlight(): bool
    {
        return false;
    }
}

Authorization

Spotlight uses canAccess() method on your Page classes to determine if a user can view or access a page.

Custom SpotlightResult

Instead of the auto generated SpotlightResult you can also create your own by adding the toSpotlightResult() method to your Page class.

php
class Dashboard extends Page
{
    public function toSpotlightResult(): SpotlightResult
    {
        return SpotlightResult::make()
            ->title('Dashboard')
            ->description('Your dashboard')
            ->icon('heroicon-o-home')
            ->route('dashboard');
    }
}

You can also just modify the auto generated SpotlightResult by adding the modifySpotlightResult() method to your Page class.

php
class Dashboard extends Page
{
    public function modifySpotlightResult(SpotlightResult $result): SpotlightResult
    {
        return $result->icon('heroicon-o-home');
    }
}