@JoolsMcFly
So edited as you suggested,
All still works,
now 2 qerties less
Querie image
I am wondering, is it normal :)
If 16 queries, are for this data, then all ok
$now = Carbon::now()->subHour();
$categories = Lesson::select('category')->groupBy('category')->get();
$procedures = Event::where('start', '>=', $now )
->where('model_id', NULL)
->where('model_status', 1)
->with('lesson.course', 'lesson.school', 'table.address')
->get();
return view('frontend.partials.procedures.index', compact('procedures', 'categories'));
This is my view:
<ul class="nav nav-pills sort-source sort-source-style-2" data-sort-id="procedures" data-option-key="filter" data-plugin-options='{"layoutMode": "fitRows", "filter": "*"}'>
<li class="all" data-hash data-option-value="*" class="active"><a class="filter" href="#"></a><a class="filter" href="#">SHOW ALL</a></li>
@foreach($categories as $categorie)
<li class="all" data-hash data-option-value=".{{$categorie->category}}"><a class="filter" href="#">{{$categorie->category}}</a></li>
@endforeach
</ul>
<tbody>
@foreach($procedures as $procedure)
<tr>
<td data-title="">
<snap class="">
<strong>{{ $procedure->present()->title }}</strong>
<span class="label label-primary pull-right">{{$procedure->present()->price}}</span>
<br>{{ $procedure->school->title }}
</snap>
</td>
<td data-title="" class="">
<snap class="">
<i class="fa fa-clock-o"></i> {{ $procedure->present()->date }}
</snap>
</td>
<td data-title="" class="">
<span class="">
<i class="fa fa-map-marker" aria-hidden="true"></i> {{ $procedure->present()->locationAddress }}
</span>
</td>
<td data-title="" class="">
<a href="@if (Auth::check()) {{ url('api/'.$procedure->id.'/procedure/data/view') }} @else {{ url('/alogin') }} @endif " data-ajax-on-modal="" type="button" class="btn btn-default mr-xs mb-sm btn-block pull-right" target="_top">Pieteikties</a>
</td>
<td style="display: none;">
{{ $procedure->present()->category }}
</td>
</tr>
@endforeach
</tbody>
And inside every menu I have this
<li class="">
<a class="" href="{{ url('procedures') }}">
Procedures <span class="label label-primary">{{count($procedures)}}</span>
</a>
</li>