How to get the given route's method in laravel 5.8

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-13 08:01:13

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!