wire-elements / spotlight

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

RegisterCommandIf Not working #39

Closed sandy15d closed 3 years ago

sandy15d commented 3 years ago

` public function boot() {

   Spotlight::registerCommandIf(Auth::check() && Auth::user()->role == 'A',Logout::class);
}`
PhiloNL commented 3 years ago

@sandy15d please use the shouldBeShown method on the command when working with dependencies that need to be resolved:

    public function shouldBeShown(Request $request): bool
    {
        return $request->user()->role == 'A;
    }

More info: https://github.com/livewire-ui/spotlight#register-commands