You can fire an event using the event()
helper function. You can also use the Event facade.
// global helper function
event(new SomeEvent($arguments));
// Event facade
Event::fire(new SomeEvent($arguments));
yes but only at certain points.. maybe be I am trying to be more ambitious but say like when user registers, i will use controller Action.. and then fire an event to maybe send them an email..
so instead of doing that in the controller Action.. could i maybe hook this on somewhere else?
Hm...I guess I'm not understanding completely so not sure if this answers your question but...
You can fire events anywhere you want / whenever you want. You can use jobs, your own class, or inside your models.
You can also hook onto already existing eloquent model events like creating, created, etc. so if a user registers, you can hook onto the "creating" event or the "created" event to do something.
Docs on eloquent model events: http://laravel.com/docs/5.1/eloquent#events
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community