Booting Eloquent Model Traits
Published on by Eric L. Barnes
Simon Archer posted a new tutorial on booting Eloquent model traits:
If you have a static function on your trait, named
boot[TraitName]
, it will be executed as theboot()
function would on an Eloquent model. Which is a handy place to register your model events.
Read the full tutorial if you’d like to find more about booting traits.
Eric is the creator of Laravel News and has been covering Laravel since 2012.