mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-12-27 10:16:47 +00:00
Merge pull request #385 from pixelfed/frontend-ui-refactor
Frontend ui refactor
This commit is contained in:
commit
5c3d0d351f
1 changed files with 4 additions and 2 deletions
|
@ -125,13 +125,15 @@ class Profile extends Model
|
||||||
|
|
||||||
public function avatar()
|
public function avatar()
|
||||||
{
|
{
|
||||||
return $this->hasOne(Avatar::class);
|
return $this->hasOne(Avatar::class)->withDefault([
|
||||||
|
'media_path' => 'public/avatars/default.png'
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function avatarUrl()
|
public function avatarUrl()
|
||||||
{
|
{
|
||||||
$url = Cache::remember("avatar:{$this->id}", 1440, function() {
|
$url = Cache::remember("avatar:{$this->id}", 1440, function() {
|
||||||
$path = $this->avatar->media_path ?? 'public/avatars/default.png';
|
$path = optional($this->avatar)->media_path;
|
||||||
$version = hash('sha1', $this->avatar->created_at);
|
$version = hash('sha1', $this->avatar->created_at);
|
||||||
$path = "{$path}?v={$version}";
|
$path = "{$path}?v={$version}";
|
||||||
return url(Storage::url($path));
|
return url(Storage::url($path));
|
||||||
|
|
Loading…
Reference in a new issue