Issue
I have master.blade.php as one of my layouts. When I load post.blade.php in browser without a wildcard like url:localhost8000/post it works and full required page is loaded but when I use a wild card url:localhost8000/post/1 the page is not completely loaded. Only the footer is displayed. Header and body appears white fire bug shows the data is present which is passed through the wildcard.
Both the pages should appear as same because the difference is only of wildcard in url.
My route file is
Route::get('post','PostsController@index');
Route::get('post/{post}','PostsController@show');
Here is my PostsController
class PostsController extends Controller{
public function index(){
return view('posts.post');
}
public function show(Post $post){
return view('posts.post',compact('post'));
}
}
Solution
When this kind of error happens, there is most likely a PHP variable error in your project.
A way to find out is to view source of the HTML and look at the first or last part of the page depending on where the error is occurring.
Also, I assume you have properly bound the keyword 'id' in your routes, in your Post model.
Answered By - Chibueze Opata
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.