wire-elements / spotlight

Livewire component that brings Spotlight/Alfred-like functionality to your Laravel application.
MIT License
927 stars 72 forks source link

Commands specific to a route #9

Closed vinhais closed 3 years ago

vinhais commented 3 years ago

Hi, It would be interesting to have something that allows some commands to appear only on one route, for example:

Command 1 -> all Command 2 -> dashboard Command 3 -> profile.*

PhiloNL commented 3 years ago

Hi,

That's possible, by conditionally registering commands. For example:

Spotlight::registerCommandIf(request()->routeIs('dashboard'), CommandTwo::class);
Spotlight::registerCommandIf(request()->routeIs('profile.*'), CommandThree::class);
vinhais commented 3 years ago

Through config, is it not possible?

PhiloNL commented 3 years ago

@vinhais nope, you will have to register the commands in your AppServiceProvider for example when using this syntax.