Hi, i want to create a middleware where i check if a user is authenticated:
public function handle($request, Closure $next)
{
$user = $request->user();
if (!$user) {
return redirect('/');
}
if (!$user->canAccessUpStats()) {
return redirect('/');
}
return $next($request);
}
But when i do a dd of $user I get null. Can someone help me?