mirror of
https://github.com/coollabsio/coolify.git
synced 2026-11-06 13:10:37 -04:00
feat(canvas): add interactive resource views and team avatars (#12160)
This commit is contained in:
@@ -2,14 +2,24 @@
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\User;
|
||||
use App\Services\AvatarStorageService;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class ProfileAvatarController extends Controller
|
||||
{
|
||||
public function __invoke(AvatarStorageService $avatarStorage): Response
|
||||
public function __invoke(AvatarStorageService $avatarStorage, ?int $user_id = null): Response
|
||||
{
|
||||
$contents = $avatarStorage->contents(auth()->user());
|
||||
$user = auth()->user();
|
||||
|
||||
if ($user_id !== null && $user_id !== $user->id) {
|
||||
$user = User::query()
|
||||
->whereKey($user_id)
|
||||
->whereHas('teams', fn ($query) => $query->whereIn('teams.id', auth()->user()->teams()->select('teams.id')))
|
||||
->firstOrFail();
|
||||
}
|
||||
|
||||
$contents = $avatarStorage->contents($user);
|
||||
abort_if($contents === null, 404);
|
||||
|
||||
return response($contents, 200, [
|
||||
|
||||
Reference in New Issue
Block a user