Be Careful to Use Laravel Eloquent’s Accessors, Mutators And Events
Lynn Lin
551

I tend to use properties inside accessors, rather than grab them from the attributes array e.g. return $this->firstName . ‘ ‘ . $this->lastName; which does not cause undefined indexes. It’s just making the most of what the framework offers instead of storing the full name in the database which many consider duplicate data. Making it clear (via comments, etc) that’s not a db column makes it a bit less awful :)

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.