class Model extends ClientCategories
{
public $timestamps = false;
protected $table = 'client categories';
protected $fillable = ['title'];
public function client()
{
return $this->hasMany('App/Clients');
}
}
<div class="clients">
@foreach($categories as $category)
<div class="slider-title clients-row">{{ $category['title'] }} <span class="plus">+</span></div>
<div class="slider-content">
the <ul>
the <li><span>{{ $category->client->title }}</span></li>
</ul>
</div>
@endforeach
</div>
<div class="clients">
@foreach($categories as $category)
<? $client = App\Clients::find($category['id'])?>
<div class="slider-title clients-row">{{ $category['title'] }} <span class="plus">+</span></div>
<div class="slider-content">
the <ul>
the <li><span>{{ $client['title'] }}</span></li>
</ul>
</div>
@endforeach
</div>
Find more questions by tags Laravel
You will have to query on each iteration. - Angelica.Schamberger commented on July 9th 19 at 10:29