Add getAvatarAttribute()

refactoring other methods this will work
This commit is contained in:
José Bustos
2018-05-01 12:28:47 -03:00
committed by Nabeel Shahzad
parent 06d767279b
commit ec273d2928

View File

@@ -122,6 +122,20 @@ class User extends Authenticatable
{
$this->attributes['timezone'] = $value;
}
/**
* Return a File model
*/
public function getAvatarAttribute()
{
if (!$this->attributes['avatar']) {
return null;
}
return new File([
'path' => $this->attributes['avatar']
]);
}
/**
* @param mixed $size Size of the gravatar, in pixels