Skip to content
Advertisement

Show.blade.php is not displaying the content from the database, only the layout

`i am having a problem with my show.blade.php template, everything works fine but when I click on a post in the index page it directs me to the /post/1 page without showing the post content only the extended layout. please help

Web.php

JavaScript

*bestpracticescontroller.php

JavaScript

bp.show view template

JavaScript

Advertisement

Answer

Thats because when you register routes via

JavaScript

Hence to achieve implicit route model binding the route parameter name must match the parameter name in the controller method

JavaScript

Or if you don’t want to change the method parameter name in the controller methods then you need to override the route parameter name in the Route:resource() call when you define routes

JavaScript

Laravel docs: https://laravel.com/docs/8.x/controllers#restful-naming-resource-route-parameters

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement