mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-22 22:41:27 +00:00
24 lines
378 B
PHP
24 lines
378 B
PHP
|
<?php
|
||
|
|
||
|
namespace App\Services;
|
||
|
|
||
|
use Cache;
|
||
|
use App\Profile;
|
||
|
|
||
|
class AvatarService
|
||
|
{
|
||
|
public static function get($profile_id)
|
||
|
{
|
||
|
$exists = Cache::get('avatar:' . $profile_id);
|
||
|
if($exists) {
|
||
|
return $exists;
|
||
|
}
|
||
|
|
||
|
$profile = Profile::find($profile_id);
|
||
|
if(!$profile) {
|
||
|
return config('app.url') . '/storage/avatars/default.jpg';
|
||
|
}
|
||
|
return $profile->avatarUrl();
|
||
|
}
|
||
|
}
|