DEV Community

Phạm Đức Huy
Phạm Đức Huy

Posted on

Answer: Passing parameters to middleware in Laravel

You can use one of the following method to access the route parameter in a middleware:

First Method

$request->route()->parameters();

This method will return an array of all the parameters.

Second Method

$request->route('parameter_name');

Here parameter_name refers to what you called the parameter in the route.

Top comments (0)