From 34a12e6ffd286a3fbae74757fa15d92f3500ba1a Mon Sep 17 00:00:00 2001 From: cp6 Date: Sat, 5 Nov 2022 12:47:08 +1100 Subject: [PATCH] Updated YABS single to be first() views updated for this Updated YABS single use first() Updated show and compare blade views --- app/Models/Yabs.php | 2 +- resources/views/yabs/compare.blade.php | 184 ++++++++++++------------- resources/views/yabs/show.blade.php | 52 +++---- 3 files changed, 119 insertions(+), 119 deletions(-) diff --git a/app/Models/Yabs.php b/app/Models/Yabs.php index df6d572..aed28a9 100644 --- a/app/Models/Yabs.php +++ b/app/Models/Yabs.php @@ -27,7 +27,7 @@ class Yabs extends Model { return Cache::remember("yabs.$yabs_id", now()->addMonth(1), function () use ($yabs_id) { return self::where('id', $yabs_id)->with(['server', 'disk_speed', 'network_speed', 'server.location', 'server.provider']) - ->get(); + ->first(); }); } diff --git a/resources/views/yabs/compare.blade.php b/resources/views/yabs/compare.blade.php index 882fc43..4bf1a1b 100644 --- a/resources/views/yabs/compare.blade.php +++ b/resources/views/yabs/compare.blade.php @@ -41,205 +41,205 @@ - {{ $yabs1_data[0]->id }} + {{ $yabs1_data->id }} DIF - {{ $yabs2_data[0]->id}} + {{ $yabs2_data->id}} Date - {{ date_format(new DateTime($yabs1_data[0]->output_date), 'g:ia D jS F Y') }} + {{ date_format(new DateTime($yabs1_data->output_date), 'g:ia D jS F Y') }} - {{\Carbon\Carbon::parse($yabs1_data[0]->output_date)->diffForHumans(\Carbon\Carbon::parse($yabs2_data[0]->output_date))}} + {{\Carbon\Carbon::parse($yabs1_data->output_date)->diffForHumans(\Carbon\Carbon::parse($yabs2_data->output_date))}} - {{ date_format(new DateTime($yabs2_data[0]->output_date), 'g:ia D jS F Y') }} + {{ date_format(new DateTime($yabs2_data->output_date), 'g:ia D jS F Y') }} Server - {{$yabs1_data[0]->server->hostname}} + {{$yabs1_data->server->hostname}} - {{$yabs2_data[0]->server->hostname}} + {{$yabs2_data->server->hostname}} CPU count - {{$yabs1_data[0]->cpu_cores}} - {!! \App\Models\Server::tableRowCompare($yabs1_data[0]->cpu_cores, $yabs2_data[0]->cpu_cores, ' cores') !!} - {{$yabs2_data[0]->cpu_cores}} + {{$yabs1_data->cpu_cores}} + {!! \App\Models\Server::tableRowCompare($yabs1_data->cpu_cores, $yabs2_data->cpu_cores, ' cores') !!} + {{$yabs2_data->cpu_cores}} CPU freq - {{$yabs1_data[0]->cpu_freq}}Mhz - {!! \App\Models\Server::tableRowCompare($yabs1_data[0]->cpu_freq, $yabs2_data[0]->cpu_freq, 'Mhz') !!} - {{$yabs2_data[0]->cpu_freq}}Mhz + {{$yabs1_data->cpu_freq}}Mhz + {!! \App\Models\Server::tableRowCompare($yabs1_data->cpu_freq, $yabs2_data->cpu_freq, 'Mhz') !!} + {{$yabs2_data->cpu_freq}}Mhz RAM - {{$yabs1_data[0]->ram_mb}}MB - {!! \App\Models\Server::tableRowCompare($yabs1_data[0]->ram_mb, $yabs2_data[0]->ram_mb, 'MB') !!} - {{$yabs2_data[0]->ram_mb}}MB + {{$yabs1_data->ram_mb}}MB + {!! \App\Models\Server::tableRowCompare($yabs1_data->ram_mb, $yabs2_data->ram_mb, 'MB') !!} + {{$yabs2_data->ram_mb}}MB Disk - {{$yabs1_data[0]->disk_gb}}GB - {!! \App\Models\Server::tableRowCompare($yabs1_data[0]->disk_gb, $yabs2_data[0]->disk_gb, 'GB') !!} - {{$yabs2_data[0]->disk_gb}}GB + {{$yabs1_data->disk_gb}}GB + {!! \App\Models\Server::tableRowCompare($yabs1_data->disk_gb, $yabs2_data->disk_gb, 'GB') !!} + {{$yabs2_data->disk_gb}}GB GB5 single - {{$yabs1_data[0]->gb5_single}} - @if(!is_null($yabs1_data[0]->gb5_single) && !is_null($yabs2_data[0]->gb5_single)) - {!! \App\Models\Server::tableRowCompare($yabs1_data[0]->gb5_single, $yabs2_data[0]->gb5_single, '') !!} + {{$yabs1_data->gb5_single}} + @if(!is_null($yabs1_data->gb5_single) && !is_null($yabs2_data->gb5_single)) + {!! \App\Models\Server::tableRowCompare($yabs1_data->gb5_single, $yabs2_data->gb5_single, '') !!} @else - @endif - {{$yabs2_data[0]->gb5_single}} + {{$yabs2_data->gb5_single}} GB5 multi - {{$yabs1_data[0]->gb5_multi}} - @if(!is_null($yabs1_data[0]->gb5_multi) && !is_null($yabs2_data[0]->gb5_multi)) - {!! \App\Models\Server::tableRowCompare($yabs1_data[0]->gb5_multi, $yabs2_data[0]->gb5_multi, '') !!} + {{$yabs1_data->gb5_multi}} + @if(!is_null($yabs1_data->gb5_multi) && !is_null($yabs2_data->gb5_multi)) + {!! \App\Models\Server::tableRowCompare($yabs1_data->gb5_multi, $yabs2_data->gb5_multi, '') !!} @else - @endif - {{$yabs2_data[0]->gb5_multi}} + {{$yabs2_data->gb5_multi}} 4k disk - {{$yabs1_data[0]->disk_speed->d_4k_as_mbps}}MB/s + {{$yabs1_data->disk_speed->d_4k_as_mbps}}MB/s - {!! \App\Models\Server::tableRowCompare($yabs1_data[0]->disk_speed->d_4k_as_mbps, $yabs2_data[0]->disk_speed->d_4k_as_mbps, 'MB/s') !!} - {{$yabs2_data[0]->disk_speed->d_4k_as_mbps}}MB/s + {!! \App\Models\Server::tableRowCompare($yabs1_data->disk_speed->d_4k_as_mbps, $yabs2_data->disk_speed->d_4k_as_mbps, 'MB/s') !!} + {{$yabs2_data->disk_speed->d_4k_as_mbps}}MB/s 64k disk - {{$yabs1_data[0]->disk_speed->d_64k_as_mbps}}MB/s + {{$yabs1_data->disk_speed->d_64k_as_mbps}}MB/s - {!! \App\Models\Server::tableRowCompare($yabs1_data[0]->disk_speed->d_64k_as_mbps, $yabs2_data[0]->disk_speed->d_64k_as_mbps, 'MB/s') !!} - {{$yabs2_data[0]->disk_speed->d_64k_as_mbps}}MB/s + {!! \App\Models\Server::tableRowCompare($yabs1_data->disk_speed->d_64k_as_mbps, $yabs2_data->disk_speed->d_64k_as_mbps, 'MB/s') !!} + {{$yabs2_data->disk_speed->d_64k_as_mbps}}MB/s 512k disk - {{$yabs1_data[0]->disk_speed->d_512k_as_mbps}}{{$yabs1_data->disk_speed->d_512k_as_mbps}}MB/s - {!! \App\Models\Server::tableRowCompare($yabs1_data[0]->disk_speed->d_512k_as_mbps, $yabs2_data[0]->disk_speed->d_512k_as_mbps, 'MB/s') !!} - {{$yabs2_data[0]->disk_speed->d_512k_as_mbps}}disk_speed->d_512k_as_mbps, $yabs2_data->disk_speed->d_512k_as_mbps, 'MB/s') !!} + {{$yabs2_data->disk_speed->d_512k_as_mbps}}MB/s 1m disk - {{$yabs1_data[0]->disk_speed->d_1m_as_mbps}}MB/s + {{$yabs1_data->disk_speed->d_1m_as_mbps}}MB/s - {!! \App\Models\Server::tableRowCompare($yabs1_data[0]->disk_speed->d_1m_as_mbps, $yabs2_data[0]->disk_speed->d_1m_as_mbps, 'MB/s') !!} - {{$yabs2_data[0]->disk_speed->d_1m_as_mbps}}MB/s + {!! \App\Models\Server::tableRowCompare($yabs1_data->disk_speed->d_1m_as_mbps, $yabs2_data->disk_speed->d_1m_as_mbps, 'MB/s') !!} + {{$yabs2_data->disk_speed->d_1m_as_mbps}}MB/s - {{$yabs1_data[0]->network_speed[0]->location}} send - {{$yabs1_data[0]->network_speed[0]->send_as_mbps}}{{$yabs1_data->network_speed[0]->location}} send + {{$yabs1_data->network_speed[0]->send_as_mbps}}MBps - {!! \App\Models\Server::tableRowCompare($yabs1_data[0]->network_speed[0]->send_as_mbps, $yabs2_data[0]->network_speed[0]->send_as_mbps, 'MBps') !!} - {{$yabs2_data[0]->network_speed[0]->send_as_mbps}}network_speed[0]->send_as_mbps, $yabs2_data->network_speed[0]->send_as_mbps, 'MBps') !!} + {{$yabs2_data->network_speed[0]->send_as_mbps}}MBps - {{$yabs1_data[0]->network_speed[0]->location}} receive - {{$yabs1_data[0]->network_speed[0]->receive_as_mbps}}{{$yabs1_data->network_speed[0]->location}} receive + {{$yabs1_data->network_speed[0]->receive_as_mbps}}MBps - {!! \App\Models\Server::tableRowCompare($yabs1_data[0]->network_speed[0]->receive_as_mbps, $yabs2_data[0]->network_speed[0]->receive_as_mbps, 'MBps') !!} - {{$yabs2_data[0]->network_speed[0]->receive_as_mbps}}network_speed[0]->receive_as_mbps, $yabs2_data->network_speed[0]->receive_as_mbps, 'MBps') !!} + {{$yabs2_data->network_speed[0]->receive_as_mbps}}MBps - @if($yabs1_data[0]->network_speed[1]->location === $yabs2_data[0]->network_speed[1]->location) + @if($yabs1_data->network_speed[1]->location === $yabs2_data->network_speed[1]->location) - {{$yabs1_data[0]->network_speed[1]->location}} send - {{$yabs1_data[0]->network_speed[1]->send_as_mbps}}{{$yabs1_data->network_speed[1]->location}} send + {{$yabs1_data->network_speed[1]->send_as_mbps}}MBps - {!! \App\Models\Server::tableRowCompare($yabs1_data[0]->network_speed[1]->send_as_mbps, $yabs2_data[0]->network_speed[1]->send_as_mbps, 'MBps') !!} - {{$yabs2_data[0]->network_speed[1]->send_as_mbps}}network_speed[1]->send_as_mbps, $yabs2_data->network_speed[1]->send_as_mbps, 'MBps') !!} + {{$yabs2_data->network_speed[1]->send_as_mbps}}MBps - {{$yabs1_data[0]->network_speed[1]->location}} receive - {{$yabs1_data[0]->network_speed[1]->receive_as_mbps}}MBps + {{$yabs1_data->network_speed[1]->location}} receive + {{$yabs1_data->network_speed[1]->receive_as_mbps}}MBps - {!! \App\Models\Server::tableRowCompare($yabs1_data[0]->network_speed[1]->receive_as_mbps, $yabs2_data[0]->network_speed[1]->receive_as_mbps, 'MBps') !!} - {{$yabs2_data[0]->network_speed[1]->receive_as_mbps}}MBps + {!! \App\Models\Server::tableRowCompare($yabs1_data->network_speed[1]->receive_as_mbps, $yabs2_data->network_speed[1]->receive_as_mbps, 'MBps') !!} + {{$yabs2_data->network_speed[1]->receive_as_mbps}}MBps @endif - @if($yabs1_data[0]->network_speed[2]->location === $yabs2_data[0]->network_speed[2]->location) + @if($yabs1_data->network_speed[2]->location === $yabs2_data->network_speed[2]->location) - {{$yabs1_data[0]->network_speed[2]->location}} send - {{$yabs1_data[0]->network_speed[2]->send_as_mbps}}{{$yabs1_data->network_speed[2]->location}} send + {{$yabs1_data->network_speed[2]->send_as_mbps}}MBps - {!! \App\Models\Server::tableRowCompare($yabs1_data[0]->network_speed[2]->send_as_mbps, $yabs2_data[0]->network_speed[2]->send_as_mbps, 'MBps') !!} - {{$yabs2_data[0]->network_speed[2]->send_as_mbps}}network_speed[2]->send_as_mbps, $yabs2_data->network_speed[2]->send_as_mbps, 'MBps') !!} + {{$yabs2_data->network_speed[2]->send_as_mbps}}MBps - {{$yabs1_data[0]->network_speed[2]->location}} receive - {{$yabs1_data[0]->network_speed[2]->receive_as_mbps}}MBps + {{$yabs1_data->network_speed[2]->location}} receive + {{$yabs1_data->network_speed[2]->receive_as_mbps}}MBps - {!! \App\Models\Server::tableRowCompare($yabs1_data[0]->network_speed[2]->receive_as_mbps, $yabs2_data[0]->network_speed[2]->receive_as_mbps, 'MBps') !!} - {{$yabs2_data[0]->network_speed[2]->receive_as_mbps}}MBps + {!! \App\Models\Server::tableRowCompare($yabs1_data->network_speed[2]->receive_as_mbps, $yabs2_data->network_speed[2]->receive_as_mbps, 'MBps') !!} + {{$yabs2_data->network_speed[2]->receive_as_mbps}}MBps @endif - @if(isset($yabs1_data[0]->network_speed[3]) && $yabs1_data[0]->network_speed[3]->location === $yabs2_data[0]->network_speed[3]->location) + @if(isset($yabs1_data->network_speed[3]) && $yabs1_data->network_speed[3]->location === $yabs2_data->network_speed[3]->location) - {{$yabs1_data[0]->network_speed[3]->location}} send - {{$yabs1_data[0]->network_speed[3]->send_as_mbps}}{{$yabs1_data->network_speed[3]->location}} send + {{$yabs1_data->network_speed[3]->send_as_mbps}}MBps - {!! \App\Models\Server::tableRowCompare($yabs1_data[0]->network_speed[3]->send_as_mbps, $yabs2_data[0]->network_speed[3]->send_as_mbps, 'MBps') !!} - {{$yabs2_data[0]->network_speed[3]->send_as_mbps}}network_speed[3]->send_as_mbps, $yabs2_data->network_speed[3]->send_as_mbps, 'MBps') !!} + {{$yabs2_data->network_speed[3]->send_as_mbps}}MBps - {{$yabs1_data[0]->network_speed[3]->location}} receive - {{$yabs1_data[0]->network_speed[3]->receive_as_mbps}}MBps + {{$yabs1_data->network_speed[3]->location}} receive + {{$yabs1_data->network_speed[3]->receive_as_mbps}}MBps - {!! \App\Models\Server::tableRowCompare($yabs1_data[0]->network_speed[3]->receive_as_mbps, $yabs2_data[0]->network_speed[3]->receive_as_mbps, 'MBps') !!} - {{$yabs2_data[0]->network_speed[3]->receive_as_mbps}}MBps + {!! \App\Models\Server::tableRowCompare($yabs1_data->network_speed[3]->receive_as_mbps, $yabs2_data->network_speed[3]->receive_as_mbps, 'MBps') !!} + {{$yabs2_data->network_speed[3]->receive_as_mbps}}MBps @endif - @if(isset($yabs1_data[0]->network_speed[4]) && $yabs1_data[0]->network_speed[4]->location === $yabs2_data[0]->network_speed[4]->location) + @if(isset($yabs1_data->network_speed[4]) && $yabs1_data->network_speed[4]->location === $yabs2_data->network_speed[4]->location) - {{$yabs1_data[0]->network_speed[4]->location}} send - {{$yabs1_data[0]->network_speed[4]->send_as_mbps}}{{$yabs1_data->network_speed[4]->location}} send + {{$yabs1_data->network_speed[4]->send_as_mbps}}MBps - {!! \App\Models\Server::tableRowCompare($yabs1_data[0]->network_speed[4]->send_as_mbps, $yabs2_data[0]->network_speed[4]->send_as_mbps, 'MBps') !!} - {{$yabs2_data[0]->network_speed[4]->send_as_mbps}}network_speed[4]->send_as_mbps, $yabs2_data->network_speed[4]->send_as_mbps, 'MBps') !!} + {{$yabs2_data->network_speed[4]->send_as_mbps}}MBps - {{$yabs1_data[0]->network_speed[4]->location}} receive - {{$yabs1_data[0]->network_speed[4]->receive_as_mbps}}MBps + {{$yabs1_data->network_speed[4]->location}} receive + {{$yabs1_data->network_speed[4]->receive_as_mbps}}MBps - {!! \App\Models\Server::tableRowCompare($yabs1_data[0]->network_speed[4]->receive_as_mbps, $yabs2_data[0]->network_speed[4]->receive_as_mbps, 'MBps') !!} - {{$yabs2_data[0]->network_speed[4]->receive_as_mbps}}MBps + {!! \App\Models\Server::tableRowCompare($yabs1_data->network_speed[4]->receive_as_mbps, $yabs2_data->network_speed[4]->receive_as_mbps, 'MBps') !!} + {{$yabs2_data->network_speed[4]->receive_as_mbps}}MBps @endif - @if(isset($yabs1_data[0]->network_speed[4]) && $yabs1_data[0]->network_speed[4]->location === $yabs2_data[0]->network_speed[5]->location) + @if(isset($yabs1_data->network_speed[4]) && $yabs1_data->network_speed[4]->location === $yabs2_data->network_speed[5]->location) - {{$yabs1_data[0]->network_speed[4]->location}} send - {{$yabs1_data[0]->network_speed[4]->send_as_mbps}}{{$yabs1_data->network_speed[4]->location}} send + {{$yabs1_data->network_speed[4]->send_as_mbps}}MBps - {!! \App\Models\Server::tableRowCompare($yabs1_data[0]->network_speed[4]->send_as_mbps, $yabs2_data[0]->network_speed[5]->send_as_mbps, 'MBps') !!} - {{$yabs2_data[0]->network_speed[5]->send_as_mbps}}network_speed[4]->send_as_mbps, $yabs2_data->network_speed[5]->send_as_mbps, 'MBps') !!} + {{$yabs2_data->network_speed[5]->send_as_mbps}}MBps - {{$yabs1_data[0]->network_speed[4]->location}} receive - {{$yabs1_data[0]->network_speed[4]->receive_as_mbps}}MBps + {{$yabs1_data->network_speed[4]->location}} receive + {{$yabs1_data->network_speed[4]->receive_as_mbps}}MBps - {!! \App\Models\Server::tableRowCompare($yabs1_data[0]->network_speed[4]->receive_as_mbps, $yabs2_data[0]->network_speed[5]->receive_as_mbps, 'MBps') !!} - {{$yabs2_data[0]->network_speed[5]->receive_as_mbps}}MBps + {!! \App\Models\Server::tableRowCompare($yabs1_data->network_speed[4]->receive_as_mbps, $yabs2_data->network_speed[5]->receive_as_mbps, 'MBps') !!} + {{$yabs2_data->network_speed[5]->receive_as_mbps}}MBps @endif diff --git a/resources/views/yabs/show.blade.php b/resources/views/yabs/show.blade.php index 8f99910..5a28b2e 100644 --- a/resources/views/yabs/show.blade.php +++ b/resources/views/yabs/show.blade.php @@ -1,4 +1,4 @@ -@section("title", "{$yab[0]->hostname} {$yab[0]->id} YABS") +@section("title", "{$yabs->hostname} {$yabs->id} YABS") {{ __('YABS details') }} @@ -15,40 +15,40 @@ Server - {{ $yab[0]->server->hostname }} + {{ $yabs->server->hostname }} Uptime - {{ $yab[0]->uptime }} + {{ $yabs->uptime }} Distro - {{ $yab[0]->distro }} + {{ $yabs->distro }} CPU - {{ $yab[0]->cpu_cores }} @ {{$yab[0]->cpu_freq}} Mhz + {{ $yabs->cpu_cores }} @ {{$yabs->cpu_freq}} Mhz CPU type - {{ $yab[0]->cpu_model }} + {{ $yabs->cpu_model }} RAM - {{ $yab[0]->ram }} {{$yab[0]->ram_type}} + {{ $yabs->ram }} {{$yabs->ram_type}} Swap - {{ $yab[0]->swap }} {{$yab[0]->swap_type}} + {{ $yabs->swap }} {{$yabs->swap_type}} Disk - {{ $yab[0]->disk }} {{$yab[0]->disk_type}} + {{ $yabs->disk }} {{$yabs->disk_type}} Has IPv6 - @if($yab[0]->has_ipv6 === 1) + @if($yabs->has_ipv6 === 1) Yes @else No @@ -58,7 +58,7 @@ AES - @if($yab[0]->aes === 1) + @if($yabs->aes === 1) Yes @else No @@ -68,7 +68,7 @@ VM - @if($yab[0]->vm === 1) + @if($yabs->vm === 1) Yes @else No @@ -77,19 +77,19 @@ GB5 Single - {{ $yab[0]->gb5_single }} + {{ $yabs->gb5_single }} GB5 Multi - {{ $yab[0]->gb5_multi }} + {{ $yabs->gb5_multi }} Test ran - @if(!is_null($yab[0]->output_date)) - {{date_format(new DateTime($yab[0]->output_date), 'g:ia D jS F Y')}} + @if(!is_null($yabs->output_date)) + {{date_format(new DateTime($yabs->output_date), 'g:ia D jS F Y')}} @endif @@ -104,25 +104,25 @@ Disk speeds: - 4k {{$yab[0]->disk_speed->d_4k}} - {{$yab[0]->disk_speed->d_4k_type}} + 4k {{$yabs->disk_speed->d_4k}} + {{$yabs->disk_speed->d_4k_type}} - 64k {{$yab[0]->disk_speed->d_64k}} - {{$yab[0]->disk_speed->d_64k_type}} + 64k {{$yabs->disk_speed->d_64k}} + {{$yabs->disk_speed->d_64k_type}} - 512k {{$yab[0]->disk_speed->d_512k}} - {{$yab[0]->d_512k_type}} + 512k {{$yabs->disk_speed->d_512k}} + {{$yabs->d_512k_type}} - 1m {{$yab[0]->disk_speed->d_1m}} {{$yab[0]->disk_speed->d_1m_type}} + 1m {{$yabs->disk_speed->d_1m}} {{$yabs->disk_speed->d_1m_type}} Network speed (location|send|receive): - @foreach($yab[0]->network_speed as $speed_test) + @foreach($yabs->network_speed as $speed_test) {{$speed_test->location}} {{$speed_test->send}}