Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set custom laravel resource controller request url

Tags:

php

laravel

enter image description here

I want to change the default request url! ex.

GET /photos/{photo}/edit change to /photos/{photo}/update GET /photos/create change to /photos/createOnePhoto

like image 222
h liu Avatar asked Oct 25 '25 07:10

h liu


1 Answers

You can't change default resource() routes. You can tell Laravel to not build some of them by using ->except(['update', 'create']).

Add all custom routes manually:

Route::get('photos/createOnePhoto', ['as' => 'photo.createOne', 'uses' => 'PhotoController@createOnePhoto'])
like image 108
Alexey Mezenin Avatar answered Oct 27 '25 22:10

Alexey Mezenin



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!