$request->user()->id
is fetching the id of the user making the request, which is of course equal to Auth::id()
.
If the parameter passed to the route is {id}
, you would access it using $request->id
. So:
if ($request->id === Auth::id()) {
return $next($request);
}
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community