php - Why use Event Listeners rather than library class or not use it at all -


why write code laravel event listeners such event::listen('user.login', 'loginhandler') instead of directly controller function?

and if several different controller functions call same code, why use event listeners rather calling static function library class?

one possible instance when writing "plugins" site can enabled/disabled @ , hook events in core code.

if want write personal use full control on code, should use library classes.


Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -