Reputation: 421
Route::resource('photos', 'PhotoController');
Give the below order by default
photos.store
photos.index
photos.create
photos.show
photos.update
photos.destroy
photos.edit
But should we organize our routes as below mentioned ? Does the order matter ?
photos.edit //photos/{photo}/edit
photos.update //photos/{photo}/update
photos.create //photos/create
photos.show //photos/{photo}
photos.destroy//photos/{photo}
photos.index //photos
photos.store //photos
Upvotes: 0
Views: 121
Reputation: 3516
In general, you should order your routes with the most specific first. Anything with a parameter should be considered a wildcard, matching all routes.
In the above example, that's what is being done and therefore, there is no problem. An other factor you should notice is - the HTTP verb being used. For example, even though, below have same urls, but the verbs are different (GET
and POST
)
photos.index //photos
photos.store //photos
Upvotes: 1