The Startup
Published in

The Startup

Laravel: Booting and Initializing Models with traits

Betcha’ you didn’t know you can do two things

Photo by Ashim D’Silva on Unsplash

One of the advantages of Eloquent ORM is how it plays nice with traits. When you use an Eloquent Model, you can execute logic when you start using the model itself.

The booting method is very magical since you can attach a Trait to the model, and if you put some methods on…




Get smarter at building your thing. Follow to join The Startup’s +8 million monthly readers & +756K followers.

Recommended from Medium

DB Interview Question — You need to tune a very slow SQL ‘select’ query on Oracle DB, How would you…

READ/DOWNLOAD< Scala for the Impatient (2nd Edition) FULL BOOK PDF & FULL AUDIOBOOK

Kubernetes Zero Trust Networking with Calico Network Policies

Why you’ll never use Fibers directly?

Featureban Online: The Facilitator Guide

Etcd3 Scala Client with gRPC API

Fantom Foundation: New Strategic Partner of Tank Wars Zone

Databricks Deployment via Jenkins

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Italo Baeza Cabrera

Italo Baeza Cabrera

Graphic Designer graduate. Full Stack Web Developer. Retired Tech & Gaming Editor.

More from Medium

AWS CloudFront Signed Cookie Laravel Middleware

Making a Post API in Laravels

Why I built Waterfall, an open-source package to perform cascading deletes.

Laravel: Subscriptions, on premises