问题
I have a route that is named editUser
when I try the following code:
return route('putUser');
It returns me the url
of the given route
now I want to check what method is used for that route,
for example, It's a GET method or POST or anything else
what should I do?
回答1:
You can get the methods defined on a named route by accessing the RouteCollection
$route = Route::getRoutes()->getByName('putUser');
$methods = $route->methods();
来源:https://stackoverflow.com/questions/58356764/how-to-get-the-given-routes-method-in-laravel-5-8