Some interface SQL performance improvements

This commit is contained in:
2024-05-11 00:00:58 +10:00
parent cd2efbd1d4
commit 4d13199848
8 changed files with 65 additions and 53 deletions

View File

@@ -28,7 +28,7 @@
</thead>
<tbody>
@foreach (\App\Models\SystemZone::select('*')->with(['system','zone.domain'])->get() as $oo)
@foreach (\App\Models\SystemZone::select('*')->with(['system.addresses.zone.domain','zone.domain'])->get() as $oo)
<tr>
<td>{{ $oo->zone->domain->name }}</td>
<td><a href="{{ url('system/addedit',[$oo->system_id]) }}">{{ $oo->system_id }}</a>@if($oo->system->hold)<span class="float-end"><i class="text-danger bi bi-stop-circle"></i></span>@endif</td>

View File

@@ -1,6 +1,7 @@
@if(($x=\App\Models\Zone::active()
->whereIn('id',$o->sessions->pluck('pivot.zone_id'))
->orderBy('zone_id')
->with(['domain'])
->get())->count())
<form class="needs-validation" method="post" action="{{ url('system/echoarea',$o->id) }}" novalidate>

View File

@@ -1,6 +1,7 @@
@if(($x=\App\Models\Zone::active()
->whereIn('id',$o->sessions->pluck('pivot.zone_id'))
->orderBy('zone_id')
->with(['domain'])
->get())->count())
<form class="needs-validation" method="post" action="{{ url('system/filearea',$o->id) }}" novalidate>

View File

@@ -2,6 +2,7 @@
@if(($x=\App\Models\Zone::active()
->whereIn('id',$o->zones->pluck('id'))
->whereNotIn('id',$o->sessions->pluck('id'))
->with(['domain'])
->get())->count())
<form class="needs-validation" method="post" action="{{ url('system/session/add',$o->id) }}" novalidate>

View File

@@ -1,4 +1,5 @@
@php
use App\Classes\FTN\Packet;
use App\Models\{Mailer,User};
@endphp
@@ -177,7 +178,7 @@
<div class="input-group">
<span class="input-group-text"><i class="bi bi-ui-radios"></i></span>
<select class="form-select @error('pkt_type') is-invalid @enderror" id="pkt_type" name="pkt_type" @cannot($action,$o)readonly @endcannot>
@foreach (\App\Classes\FTN\Packet::PACKET_TYPES as $type => $class)
@foreach (Packet::PACKET_TYPES as $type => $class)
<option value="{{ $type }}" @if(old('pkt_type',$o->pkt_type ?: config('fido.packet_default')) === $type)selected @endif>{{ $type }}</option>
@endforeach
</select>
@@ -349,7 +350,7 @@
Last Poll:
</div>
<div class="col-8">
<strong class="highlight">{{ ($x=$o->logs->where('originate',TRUE)->last())?->created_at ?: 'Never' }}</strong>
<strong class="highlight">{{ ($x=$o->logs()->where('originate',TRUE)->orderBy('created_at','DESC')->limit(1)->single())?->created_at ?: 'Never' }}</strong>
</div>
</div>