Skip to content

Instantly share code, notes, and snippets.

@isurum
Created July 18, 2017 12:33
Show Gist options
  • Save isurum/e9d7c471b7057b639ebed6acfe78795f to your computer and use it in GitHub Desktop.
Save isurum/e9d7c471b7057b639ebed6acfe78795f to your computer and use it in GitHub Desktop.
Laravel 5.4 Bootstrap row class for every 3 columns - Blade Template
@foreach($products->chunk(3) as $items)
<div class="row">
@foreach($items as $item)
<div class="col-md-4 portfolio-item">
<a href="#">
<img class="img-responsive" src="{{ 'uploads/'.$item->product_image_url }}" alt="">
</a>
<h3>
<a href="/view-product-details/{{ $item->id }}">{{ $item->product_name }}</a>
</h3>
<p>{{ str_limit($item->product_description, 121) }}</p>
</div>
@endforeach
</div>
@endforeach
public function showProducts(){
$products = DB::table('products')->paginate(9);
return view('products', ['products' => $products]);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment