wire-elements / spotlight

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

Add ability to set display logic on each component #15

Closed dvanscott closed 3 years ago

dvanscott commented 3 years ago

This update allows for using a method on individual Spotlight Command components for any custom logic that should be used to determine whether the component should be shown in the Spotlight component. I went down this path primarily due to the fact that the authenticated user isn't available in the service providers.

I'm not in love with the method name. Originally I was using shouldRegister, but that's not really what's happening since the command component is registered, but is being filtered out before it's sent to the Livewire component. I settled on shouldBeShown since "shown" is the language that's used in some of the docblocks. If there's a better method name you can think of, I'm happy to change this.

dvanscott commented 3 years ago

@PhiloNL All set. Thanks for your help with this one!

dvanscott commented 3 years ago

Also just pushed up an update to the README file documenting this change.

PhiloNL commented 3 years ago

Awesome! Thanks @dvanscott! 😄