Ребята всем привет. Есть две связи
Модель Filter
public function group()
{
return $this->belongsTo('App\Models\Group')->orderByAsc('priority');
}
Модель Group
public function filters()
{
return $this->hasMany('App\Models\Filter');
}
Вот что во view
@foreach ($product->filters as $filter)
<tr>
<td class="table-text-child uk-width-medium" style="font-weight:500;"> {{$filter->group->name}}:</td>
<td class="table-text-child">{{$filter->name}}</td>
</tr>
@endforeachнужно получить отсортированную группу (Group) по полю priority