Why is creating Eloquent event handlers with closures no longer documented?

Posted 2 years ago by orrd

Laravel 5.4 now has a $events array that you can use to map Eloquent events to dedicated classes. But sometimes you don't want to have to create a new class just to log events for a model. Previous versions let you do something like User::creating(function ($user) { ... } to use a closure to easily define event handlers without having to create a new class.

I'm concerned that while the closure technique way still works, it was removed from the documentation. Is that just an oversight, or should we be concerned that the closure technique of defining event handlers could go away? Why is it no longer in the documentation?

Please sign in or create an account to participate in this conversation.

Reply to

Use Markdown with GitHub-flavored code blocks.