I have segments. There are categories that segments have. Each segment consists of 3 categories and the middle segment is the main segment. How can I show them on the blade?
I write code like this.
$seg = DB::table('segments')->get();
$categories = DB::table('categories')
->join('category_translations', 'category_translations.category_id', 'categories.id')
->select('categories.id', 'category_translations.category_name')
->where('language_id', $lan->id)
->get();
$seg_cat = DB::table('segment_categories')->get();
@foreach($seg as $segment)
<section class="news-block">
<div class="container">
<div class="row">
@foreach($seg_cat as $segment_categories)
@if($segment->id == $segment_categories->segment_id)
@foreach($categories as $cat)
@if($cat->id == $segment_categories->category_id)
<div class="col-lg-3">
</div>
<div class="col-lg-6">
</div>
</div>
<div class="col-lg-3">
</div>
@endif
@endforeach
@endif
@endforeach
Aucun commentaire:
Enregistrer un commentaire