I am trying to create a blog using Laravel 5.5 but I have received this error.
"Missing required parameters for [Route: posts.show] [URI: posts/{post}]. (View: /home/vagrant/Code/dialhousesetup.test/resources/views/posts/index.blade.php)"
On my postcontroller.php file. I did this so I can output all posts on my database:
public function index()
{
//Create a variable and store all the blog posts in it from the data base
$posts = Post::all();
//Return a view and pass in the above variable
return view('posts.index', array('posts' => $posts));
}
This is the loop I wrote on the /posts page to display all the blog posts.
<div class="events mb-100">
<div class="container">
<div class="row">
@foreach ($posts as $post)
<div class="col-md-6">
<a href="">
<div class="single-event text-center">
<img src="http://www.dialhousehotel.com/wp-content/uploads/2018/01/CC_1419-The-Dial-House-website-01-18-04.jpg" alt="" style="border:2px solid #bb9b50;">
<h2></h2>
<p></p>
<div class="separator"></div>
<a href=""><button type="submit" class="button button-simple mt-30">Read More</button></a>
</div>
</a>
</div>
@endforeach
</div>
</div>
</div>
I honestly don't know what I did wrong.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire