Homepage
Homepage
Become a memberSign inGet started
Tagged in

Traits

  1. Web Development
  2. PHP
  3. Traits
Related tags
  • PHP
  • Personality
  • Entrepreneurship
  • Laravel
  • Programming
  • Leadership
  • Life Lessons
  • Rust
  • Scala
  • Top stories

  • Archive

Go to the profile of Tom Ellis
Tom Ellis
Sep 5, 2018

Using PHP Traits for Laravel Eloquent Relationships

I recently began refactoring a bunch of code on a project and found myself putting the same methods on my Eloquent models for a relation to an Account class. FYI I prefer to have getters and setters rather than accessing properties…

Read more…
7 responses
Go to the profile of Kshitij Soni
Kshitij Soni
Dec 12, 2017

Traits in PHP and Laravel

One of the problems of PHP as a programming language is the fact that you can only have single inheritance. This means a class can only inherit from one other class. For example, it might be desirable to inherit methods from a couple of different classes in order to prevent code…

Read more…
7 responses