Add getAvatarAttribute()
refactoring other methods this will work
This commit is contained in:
committed by
Nabeel Shahzad
parent
06d767279b
commit
ec273d2928
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user