router - How to get route name in Laravel?
给我你的怀抱
给我你的怀抱 2017-05-16 16:47:45
0
2
554
Route::resource('photo', 'PhotoController');

//GET           /photos                    index
//GET           /photos/create            create
//POST          /photos                    store
//GET            /photos/{photo}            show
//GET            /photos/{photo}/edit    edit
//PUT/PATCH        /photos/{photo}            update
//DELETE        /photos/{photo}            destroy

The corresponding route names are:

photo.index
photo.create
photo.store
photo.show
photo.edit
photo.destory

Assume the domain name is: www.longlongago.top

www.longlongago.top/photos

How to get its routing name photo.index
based on

www.longlongago.top/photos
给我你的怀抱
给我你的怀抱

reply all(2)
迷茫

Laravel uses the restful architecture style. If you are not sure about it, you can check it online.
resource is a resource route that can point to the corresponding method under the controller according to the request method
For example: directly access the URL www.longlongago.top/photos, first determine that this is a get request, so the program will The default method to find index

漂亮男人

Route::currentRouteName()

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template