Search code examples
laravellaravel-5.3

Laravel 5.3 get request value in route file web.php


Im trying to access request in web.php file but cant find a function to call. Request is passed automatically to all controller functions but I want to perform action common for all routes so I wanted to do it in route/web.php file that is new route file in Laravel 5.3.

i tried

$request = Route::getCurrentRequest();

but it returns null.


Solution

  • You can use request() global helper in web.php

    dd(request());