0

I would like to create a blog with several different divs. I would use a foreach cycle

@foreach($posts as $post) <div class="col-lg-12"> <article class="post">	<div class="post-background" data-background="{{ Storage::disk('public')->url('post/'.$post->image) }}">	<div class="post-header">	<h2 class="post-title"><a href="blog-single.html">{{ $post->title }}</a></h2>	<ul class="post-meta h5">	<li>November 18, 2016</li>	<li><a href="#">Branding</a>, <a href="#">Design</a></li>	<li><a href="#">3 Comments</a></li>	</ul>	</div><a class="post-background-link" href="blog-single.html"></a>	</div>	</article> </div> @endforeach

This is the result

But as we know, foreach involves using the same layout. How can I remedy this?

2
  • Can't you include a dynamic template (algorythm you need) and use this : stackoverflow.com/questions/29739745/… Commented Dec 11, 2018 at 20:56
  • You could store the layout details of each post in the posts array Commented Dec 12, 2018 at 9:23

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.