Add getAvatarAttribute()
refactoring other methods this will work
This commit is contained in:
committed by
Nabeel Shahzad
parent
06d767279b
commit
ec273d2928
@@ -123,6 +123,20 @@ class User extends Authenticatable
|
|||||||
$this->attributes['timezone'] = $value;
|
$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
|
* @param mixed $size Size of the gravatar, in pixels
|
||||||
* @return string
|
* @return string
|
||||||
|
|||||||
Reference in New Issue
Block a user