laravel dynamic attributes code example
Example 1: laravel dynamic attributes
class User extends Eloquent {
public function getFullNameAttribute()
{
return $this->first_name.' '.$this->last_name;
}
}
Example 2: laravel dynamic attributes
$user = User::find(1);
$user->full_name;