Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 966
pera Avatar asked Dec 12 '16 16:12

pera


Video Answer


1 Answers

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

dd(request());
like image 62
Alexey Mezenin Avatar answered Sep 21 '22 06:09

Alexey Mezenin