Support the ongoing development of Laravel.io →
Requests Views Blade
Last updated 2 years ago.
0
Solution

Try to add this route underneath.

Route::get('/{id}', 'PostsController@show');
Last updated 9 years ago.
0

Your route is calling a controller, but not the function in the controller as @nepras mentions. Your route should be:

Route::get('/{id}/','PostsController@show');

or

Route::get('/{id}',['as' => 'id','uses' => 'PostsController@show']);
Last updated 9 years ago.
0

Thank you for your replies.

rberlin01 said:

Your route is calling a controller, but not the function in the controller as @nepras mentions.

This is RESTful Controller, by defining this route:

Route::resource('/', 'PostsController');

I can use these methods: index, create, store, show, edit, update, destroy

docs

This solution is worked for me, but after doing so, I needed to define other route like so either:

Route::resource('/', 'PostsController');
Route::get('/{id}', 'PostsController@show');
Route::get('/{id}/edit', 'PostsController@edit');
Route::put('/{id}', 'PostsController@update');
Route::delete('/{id}', 'PostsController@destroy');

Anyway, thank you!

Last updated 9 years ago.

d252874 liked this reply

1

Sign in to participate in this thread!

Eventy

Your banner here too?

4unkur 4unkur Joined 15 Aug 2015

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.