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

تعليقات

المشاركات الشائعة من هذه المدونة

I am unable to figure out how to create payment collection request, after a form has been submitted in laravel

laravel, mysql transaction not working after failed one time