O'Reilly logo
  • GIL EG thinks this is interesting:

<?php namespace App; use Illuminate\Database\Eloquent\Model; class User extends Model { protected $appends = ['complete_name']; public function getCompleteNameAttribute() { return $this->attributes['first_name']. ' ' . $this->attributes['last_name']; } }

From

Cover of Learning Laravel's Eloquent

Note

appends attributes