mirror of
https://github.com/sp-tarkov/forge.git
synced 2025-02-12 20:20:41 -05:00
Remove Controller User Model Binding
We're going to being in the user id from the URI instead so we can do a custom lookup on it.
This commit is contained in:
parent
b67dd2fd97
commit
be05d2693e
@ -11,8 +11,12 @@ class UserController extends Controller
|
||||
{
|
||||
use AuthorizesRequests;
|
||||
|
||||
public function show(Request $request, User $user, string $username): View
|
||||
public function show(Request $request, int $userId, string $username): View
|
||||
{
|
||||
$user = User::where('id', $userId)
|
||||
// Reimplement eager loading after the review.
|
||||
->firstOrFail();
|
||||
|
||||
if ($user->slug() !== $username) {
|
||||
abort(404);
|
||||
}
|
||||
@ -21,11 +25,6 @@ class UserController extends Controller
|
||||
abort(403);
|
||||
}
|
||||
|
||||
// not sure if this is optimal. Some way to do $user->with(...) ???
|
||||
$user = User::where('id', $user->id)
|
||||
->with(['followers', 'following'])
|
||||
->firstOrFail();
|
||||
|
||||
return view('user.show', compact('user'));
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user