Search code examples
laravellaravel-5.3

Why request() helper return empty array?


I want to use request information at report() function in Error Handler, but can't get it.

public function report(Exception $exception)
{
    $request = request();
    // -> empty array
    parent::report($exception);
}

Why request() helper return empty array? Thanks.


Solution

  • You can use url helpers:

    url()->current();
    

    or

    url()->full();