Support the ongoing development of Laravel.io →
posted 9 years ago
Architecture
Last updated 2 years ago.
0

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));

http://laravel.com/docs/5.1/events

0

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?

0

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

0

Sign in to participate in this thread!

Eventy

Your banner here too?

shez1983 shez1983 Joined 31 Dec 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.