mirror of
https://github.com/sp-tarkov/forge.git
synced 2025-02-13 04:30:41 -05:00
Refringe
80f3da13b9
Much better, still not perfect. The mobile and the desktop components are being rendered twice, and each of their methods are running twice as well. Going to see if I can modify the structure to get away with only using one.
41 lines
958 B
PHP
41 lines
958 B
PHP
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
use App\Models\User;
|
|
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\View\View;
|
|
|
|
class UserController extends Controller
|
|
{
|
|
use AuthorizesRequests;
|
|
|
|
public function show(Request $request, int $userId, string $username): View
|
|
{
|
|
$user = User::whereId($userId)
|
|
->with(['following', 'followers'])
|
|
->firstOrFail();
|
|
|
|
$mods = $user->mods()
|
|
->with([
|
|
'users',
|
|
'latestVersion',
|
|
'latestVersion.latestSptVersion',
|
|
])
|
|
->orderByDesc('created_at')
|
|
->paginate(10)
|
|
->fragment('mods');
|
|
|
|
if ($user->slug() !== $username) {
|
|
abort(404);
|
|
}
|
|
|
|
if ($request->user()?->cannot('view', $user)) {
|
|
abort(403);
|
|
}
|
|
|
|
return view('user.show', compact('user', 'mods'));
|
|
}
|
|
}
|