lundi 9 novembre 2020

Laravel Auth in middleware [duplicate]

I have some problems with authentication on my middleware file. I'm logging on which page is client last seen, like so:

public function handle(Request $request, Closure $next)
    {
        Activity::create(['user_id' => Auth::id(), 'ip_id' => SecureAgent::getIP(), 'action' => $request->method(), 'page' => $request->path()]);
        

        return $next($request);
    }

File in Karnel is added in $middleware;

The problem is that Auth::id() is not working, only NULL. I have logged in with passport, set my token and redirect to profile page, everything is working fine except this middleware.



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/3lqwSAk
via IFTTT

Aucun commentaire:

Enregistrer un commentaire