Getting the Authentication Request Instance

Problem

You want to access the request instance used by authentication.

Solution

Use the Auth::getRequest() method.

$request = Auth::getRequest();

Discussion

Usually you can just access the Request facade.

By default Laravel uses the same request for both the Request facade and the Auth facade. This means unless your application is explicitly setting the request, it's easier to use the Request facade.

comments powered by Disqus