dynamic attribute in laravel 8 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;