You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Let's say that you create a resourceful controller for photos.
Route::resource('photos', 'PhotosController');
Laravel will then automatically create the necessary named routes, like photos.index, photos.show, etc.
The only confusion (unless I'm being dense) stems from generating URLs and such. For example, if I want to generate a URL to display one photo, I'd expect to do:
route('photos.show', ['id' => $id]);
However, that won't work. Laravel wants me to use the photos key instead.
route('photos.show', ['photos' => $id]);
That's not intuitive. Can we use {id} instead of {photos}? Or am I missing something simple?
Let's say that you create a resourceful controller for photos.
Laravel will then automatically create the necessary named routes, like
photos.index
,photos.show
, etc.The only confusion (unless I'm being dense) stems from generating URLs and such. For example, if I want to generate a URL to display one photo, I'd expect to do:
However, that won't work. Laravel wants me to use the
photos
key instead.That's not intuitive. Can we use
{id}
instead of{photos}
? Or am I missing something simple?http://enva.to/ViuzRp
The text was updated successfully, but these errors were encountered: