F
Filament7mo ago
Robin

Add custom events to plugin

Hello, I don't seem to see a way to add custom events (queued or not) to a plugon. Anyone who can guide me with this?
7 Replies
LeandroFerreira
LeandroFerreira7mo ago
you could explain what is the goal, what code you are trying, etc..
awcodes
awcodes7mo ago
Are you trying to use them in a plug-in you control or into someone else’s plugin?
Robin
Robin7mo ago
I'm trying to write a plugin on my own, but it would require an event event() to be dispatched. I don't really know where I could register this event, because now I get the error that the event cant be found. I'm hoping I don't need to regiter it in the main application (just for the sake of simplicity for the user)
Lara Zeus
Lara Zeus7mo ago
ist the same as laravel events this is an example how I did it https://github.com/lara-zeus/bolt/tree/3.x/src/Events
Robin
Robin7mo ago
But how do you register them? Because I get (in the application I have it running) that the class is not found
Lara Zeus
Lara Zeus7mo ago
you call it whereever you want event() and your users will listen to them https://larazeus.com/docs/bolt/v3/advanced/events
Robin
Robin7mo ago
Ohgod, I placed it outside of the src folder 🤦‍♂️ Thanks!!!
Want results from more Discord servers?
Add your server