Updated Server model & Added LabelsAssigned model

Huge update for Server to use relationships (no more joins)
Created LabelsAssigned class for the labels relationship
Removed pricingForService() function
Removed now unused server cache forgets
This commit is contained in:
cp6 2022-07-19 13:12:51 +10:00
parent 38fe21bbef
commit 0491f84ed4
9 changed files with 428 additions and 322 deletions

View File

@ -19,9 +19,9 @@ class ServerController extends Controller
public function index() public function index()
{ {
$servers = Server::activeServersDataIndexPage(); $servers = Server::allActiveServers();
$non_active_servers = Server::nonActiveServersDataIndexPage(); $non_active_servers = Server::allNonActiveServers();
return view('servers.index', compact(['servers', 'non_active_servers'])); return view('servers.index', compact(['servers', 'non_active_servers']));
} }
@ -41,7 +41,7 @@ class ServerController extends Controller
Session::save(); Session::save();
if ((Session::get('show_servers_public') === 1)) { if ((Session::get('show_servers_public') === 1)) {
$servers = Server::publicServerData(); $servers = Server::allPublicServers();
return view('servers.public-index', compact('servers')); return view('servers.public-index', compact('servers'));
} }
return response()->view('errors.404', array("status" => 404, "title" => "Page not found", "message" => ""), 404); return response()->view('errors.404', array("status" => 404, "title" => "Page not found", "message" => ""), 404);
@ -121,24 +121,16 @@ class ServerController extends Controller
public function show(Server $server) public function show(Server $server)
{ {
$server_extras = Server::serverDataShowPage($server->id); $server_data = Server::server($server->id)[0];
$network_speeds = Yabs::networkSpeedsForServer($server->id); return view('servers.show', compact(['server_data']));
$ip_addresses = IPs::ipsForServer($server->id);
$labels = Labels::labelsForService($server->id);
return view('servers.show', compact(['server', 'server_extras', 'network_speeds', 'labels', 'ip_addresses']));
} }
public function edit(Server $server) public function edit(Server $server)
{ {
$ip_addresses = IPs::ipsForServer($server->id); $server_data = Server::server($server->id)[0];
$server = Pricing::pricingForService($server->id); return view('servers.edit', compact(['server_data']));
return view('servers.edit', compact(['server', 'ip_addresses']));
} }
public function update(Request $request, Server $server) public function update(Request $request, Server $server)
@ -229,28 +221,24 @@ class ServerController extends Controller
} }
public function chooseCompare() public function chooseCompare()
{ {//NOTICE: Selecting servers is not cached yet
$all_servers = Server::where('has_yabs', 1)->get(); $all_servers = Server::where('has_yabs', 1)->get();
return view('servers.choose-compare', compact('all_servers')); return view('servers.choose-compare', compact('all_servers'));
} }
public function compareServers($server1, $server2) public function compareServers($server1, $server2)
{ {
$server1_data = Server::serverCompareData($server1); $server1_data = Server::server($server1);
if (count($server1_data) === 0) { if (!isset($server1_data[0]->yabs[0])) {
return response()->view('errors.404', array("status" => 404, "title" => "Page not found", "message" => "No server with YABs data was found for id '$server1'"), 404); return response()->view('errors.404', array("status" => 404, "title" => "Page not found", "message" => "No server with YABs data was found for id '$server1'"), 404);
} }
$server1_network = Yabs::serverCompareNetwork($server1_data[0]->yabs_id); $server2_data = Server::server($server2);
$server2_data = Server::serverCompareData($server2); if (!isset($server2_data[0]->yabs[0])) {
if (count($server2_data) === 0) {
return response()->view('errors.404', array("status" => 404, "title" => "Page not found", "message" => "No server with YABs data was found for id '$server2'"), 404); return response()->view('errors.404', array("status" => 404, "title" => "Page not found", "message" => "No server with YABs data was found for id '$server2'"), 404);
} }
return view('servers.compare', compact('server1_data', 'server2_data'));
$server2_network = Yabs::serverCompareNetwork($server2_data[0]->yabs_id);
return view('servers.compare', compact('server1_data', 'server2_data', 'server1_network', 'server2_network'));
} }
} }

View File

@ -0,0 +1,23 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class LabelsAssigned extends Model
{
use HasFactory;
public $incrementing = false;
public $table = 'labels_assigned';
protected $fillable = ['label_id', 'service_id'];
public function label()
{
return $this->hasOne(Labels::class, 'id', 'label_id');
}
}

View File

@ -141,13 +141,4 @@ class Pricing extends Model
}); });
} }
public static function pricingForService(string $service_id)
{
return Cache::remember("service_pricing.$service_id", now()->addWeek(1), function () use ($service_id) {
return DB::table('servers as s')
->join('pricings as p', 's.id', '=', 'p.service_id')
->where('s.id', '=', $service_id)
->get(['s.*', 'p.*']);
});
}
} }

View File

@ -2,6 +2,7 @@
namespace App\Models; namespace App\Models;
use App\Process;
use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\Cache; use Illuminate\Support\Facades\Cache;
@ -21,6 +22,48 @@ class Server extends Model
*/ */
private $id; private $id;
public static function allServers()
{//All servers and relationships (no using joins)
return Cache::remember("all_servers", now()->addMonth(1), function () {
return Server::with(['location', 'provider', 'os', 'price', 'ips', 'yabs', 'yabs.disk_speed', 'yabs.network_speed', 'labels', 'labels.label'])->get();
});
}
public static function server(string $server_id)
{//Single server and relationships (no using joins)
return Cache::remember("server.$server_id", now()->addMonth(1), function () use ($server_id) {
return Server::where('id', $server_id)
->with(['location', 'provider', 'os', 'price', 'ips', 'yabs', 'yabs.disk_speed', 'yabs.network_speed', 'labels', 'labels.label'])->get();
});
}
public static function allActiveServers()
{//All ACTIVE servers and relationships replaces activeServersDataIndexPage()
return Cache::remember("all_active_servers", now()->addMonth(1), function () {
return Server::where('active', '=', 1)
->with(['location', 'provider', 'os', 'price', 'ips', 'yabs', 'yabs.disk_speed', 'yabs.network_speed', 'labels', 'labels.label'])
->get();
});
}
public static function allNonActiveServers()
{//All NON ACTIVE servers and relationships replaces nonActiveServersDataIndexPage()
return Cache::remember("non_active_servers", now()->addMonth(1), function () {
return Server::where('active', '=', 0)
->with(['location', 'provider', 'os', 'price', 'ips', 'yabs', 'yabs.disk_speed', 'yabs.network_speed', 'labels', 'labels.label'])
->get();
});
}
public static function allPublicServers()
{//server data that will be publicly viewable (values in settings)
return Cache::remember("public_server_data", now()->addMonth(1), function () {
return Server::where('show_public', '=', 1)
->with(['location', 'provider', 'os', 'price', 'ips', 'yabs', 'yabs.disk_speed', 'yabs.network_speed', 'labels', 'labels.label'])
->get();
});
}
public static function serviceServerType($type) public static function serviceServerType($type)
{ {
if ($type === 1) { if ($type === 1) {
@ -158,11 +201,12 @@ class Server extends Model
public static function serverRelatedCacheForget(): void public static function serverRelatedCacheForget(): void
{ {
Cache::forget('all_servers');//All servers
Cache::forget('services_count');//Main page services_count cache Cache::forget('services_count');//Main page services_count cache
Cache::forget('due_soon');//Main page due_soon cache Cache::forget('due_soon');//Main page due_soon cache
Cache::forget('recently_added');//Main page recently_added cache Cache::forget('recently_added');//Main page recently_added cache
Cache::forget('all_active_servers');//all servers cache Cache::forget('all_active_servers');//all active servers cache
Cache::forget('non_active_servers');//all servers cache Cache::forget('non_active_servers');//all non active servers cache
Cache::forget('servers_summary');//servers summary cache Cache::forget('servers_summary');//servers summary cache
Cache::forget('public_server_data');//public servers Cache::forget('public_server_data');//public servers
Cache::forget('all_pricing');//All pricing Cache::forget('all_pricing');//All pricing
@ -172,88 +216,50 @@ class Server extends Model
public static function serverSpecificCacheForget(string $server_id): void public static function serverSpecificCacheForget(string $server_id): void
{ {
Cache::forget("server_show_data.$server_id");//data for show Cache::forget("server.$server_id");//Will replace one below
Cache::forget("ip_addresses.$server_id");//ips for server
Cache::forget("labels_for_service.$server_id");//labels for server
Cache::forget("service_pricing.$server_id");//Pricing Cache::forget("service_pricing.$server_id");//Pricing
} }
public static function activeServersDataIndexPage()
{
return Cache::remember('all_active_servers', now()->addMonth(1), function () {
return DB::table('servers as s')
->join('pricings as pr', 's.id', '=', 'pr.service_id')
->join('providers as p', 's.provider_id', '=', 'p.id')
->join('locations as l', 's.location_id', '=', 'l.id')
->join('os as o', 's.os_id', '=', 'o.id')
->where('s.active', '=', 1)
->get(['s.*', 'pr.currency', 'pr.price', 'pr.term', 'pr.as_usd', 'pr.next_due_date', 'p.name as provider_name', 'l.name as location', 'o.name as os_name']);
});
}
public static function nonActiveServersDataIndexPage()
{
return Cache::remember('non_active_servers', now()->addMonth(1), function () {
return DB::table('servers as s')
->join('pricings as pr', 's.id', '=', 'pr.service_id')
->join('providers as p', 's.provider_id', '=', 'p.id')
->join('locations as l', 's.location_id', '=', 'l.id')
->join('os as o', 's.os_id', '=', 'o.id')
->where('s.active', '=', 0)
->get(['s.*', 'pr.currency', 'pr.price', 'pr.term', 'pr.as_usd', 'p.name as provider_name', 'l.name as location', 'o.name as os_name']);
});
}
public static function serverDataShowPage(string $server_id)
{
return Cache::remember("server_show_data.$server_id", now()->addDay(1), function () use ($server_id) {
return DB::table('servers as s')
->join('pricings as pr', 's.id', '=', 'pr.service_id')
->join('providers as p', 's.provider_id', '=', 'p.id')
->join('locations as l', 's.location_id', '=', 'l.id')
->join('os as o', 's.os_id', '=', 'o.id')
->Leftjoin('yabs as y', 's.id', '=', 'y.server_id')
->Leftjoin('disk_speed as ds', 'y.id', '=', 'ds.id')
->where('s.id', '=', $server_id)
->get(['s.*', 'p.name as provider', 'l.name as location', 'o.name as os_name', 'pr.*', 'y.*', 'ds.*']);
});
}
public static function publicServerData()
{
return Cache::remember('public_server_data', now()->addMonth(1), function () {
return DB::table('servers as s')
->Join('pricings as pr', 's.id', '=', 'pr.service_id')
->Join('providers as p', 's.provider_id', '=', 'p.id')
->Join('locations as l', 's.location_id', '=', 'l.id')
->Join('os as o', 's.os_id', '=', 'o.id')
->LeftJoin('ips as i', 's.id', '=', 'i.service_id')
->LeftJoin('yabs as y', 's.id', '=', 'y.server_id')
->LeftJoin('disk_speed as ds', 'y.id', '=', 'ds.id')
->where('s.show_public', '=', 1)
->get(['pr.currency', 'pr.price', 'pr.term', 'pr.as_usd', 'pr.next_due_date', 'pr.service_id', 'p.name as provider_name', 'l.name as location', 'o.name as os_name', 'y.*', 'y.id as yabs_id', 'ds.*', 's.*', 'i.address as ip', 'i.is_ipv4']);
});
}
public static function serverCompareData(string $server_id)
{
return Cache::remember("server_compare.$server_id", now()->addMonth(1), function () use ($server_id) {
return DB::table('servers as s')
->join('pricings as pr', 's.id', '=', 'pr.service_id')
->join('providers as p', 's.provider_id', '=', 'p.id')
->join('locations as l', 's.location_id', '=', 'l.id')
->Join('yabs as y', 's.id', '=', 'y.server_id')
->Join('disk_speed as ds', 'y.id', '=', 'ds.id')
->where('s.id', '=', $server_id)
->get(['s.*', 'p.name as provider_name', 'l.name as location', 'pr.*', 'y.*', 'y.id as yabs_id', 'ds.*']);
});
}
public static function serverYabsAmount(string $server_id): int public static function serverYabsAmount(string $server_id): int
{ {//Returns amount of YABs a server has
return DB::table('yabs') return DB::table('yabs')
->where('server_id', '=', $server_id) ->where('server_id', '=', $server_id)
->get()->count(); ->get()->count();
} }
public function yabs()
{
return $this->hasMany(Yabs::class, 'server_id', 'id');
}
public function ips()
{
return $this->hasMany(IPs::class, 'service_id', 'id');
}
public function location()
{
return $this->hasOne(Locations::class, 'id', 'location_id');
}
public function provider()
{
return $this->hasOne(Providers::class, 'id', 'provider_id');
}
public function os()
{
return $this->hasOne(OS::class, 'id', 'os_id');
}
public function price()
{
return $this->hasOne(Pricing::class, 'service_id', 'id');
}
public function labels()
{
return $this->hasMany(LabelsAssigned::class, 'service_id', 'id');
}
} }

View File

@ -1,4 +1,6 @@
@section('title') {{'Compare servers'}} @endsection @section('title')
{{'Compare servers'}}
@endsection
@section('style') @section('style')
<style> <style>
.td-nowrap { .td-nowrap {
@ -49,185 +51,271 @@
<tbody> <tbody>
<tr> <tr>
<td class="td-nowrap">CPU count</td> <td class="td-nowrap">CPU count</td>
<td class="td-nowrap">{{$server1_data[0]->cpu_cores}}</td> <td class="td-nowrap">{{$server1_data[0]->yabs[0]->cpu_cores}}</td>
{!! \App\Models\Server::tableRowCompare($server1_data[0]->cpu_cores, $server2_data[0]->cpu_cores, ' cores') !!} {!! \App\Models\Server::tableRowCompare($server1_data[0]->yabs[0]->cpu_cores, $server2_data[0]->yabs[0]->cpu_cores, ' cores') !!}
<td class="td-nowrap">{{$server2_data[0]->cpu_cores}}</td> <td class="td-nowrap">{{$server2_data[0]->yabs[0]->cpu_cores}}</td>
</tr> </tr>
<tr> <tr>
<td class="td-nowrap">CPU freq</td> <td class="td-nowrap">CPU freq</td>
<td class="td-nowrap">{{$server1_data[0]->cpu_freq}}<span class="data-type">Mhz</span></td> <td class="td-nowrap">{{$server1_data[0]->yabs[0]->cpu_freq}}<span
{!! \App\Models\Server::tableRowCompare($server1_data[0]->cpu_freq, $server2_data[0]->cpu_freq, 'Mhz') !!} class="data-type">Mhz</span></td>
<td class="td-nowrap">{{$server2_data[0]->cpu_freq}}<span class="data-type">Mhz</span></td> {!! \App\Models\Server::tableRowCompare($server1_data[0]->yabs[0]->cpu_freq, $server2_data[0]->yabs[0]->cpu_freq, 'Mhz') !!}
<td class="td-nowrap">{{$server2_data[0]->yabs[0]->cpu_freq}}<span
class="data-type">Mhz</span></td>
</tr> </tr>
<tr> <tr>
<td class="td-nowrap">Ram</td> <td class="td-nowrap">Ram</td>
<td class="td-nowrap">{{$server1_data[0]->ram_mb}}<span class="data-type">MB</span></td> <td class="td-nowrap">{{$server1_data[0]->yabs[0]->ram_mb}}<span class="data-type">MB</span>
{!! \App\Models\Server::tableRowCompare($server1_data[0]->ram_mb, $server2_data[0]->ram_mb, 'MB') !!} </td>
<td class="td-nowrap">{{$server2_data[0]->ram_mb}}<span class="data-type">MB</span></td> {!! \App\Models\Server::tableRowCompare($server1_data[0]->yabs[0]->ram_mb, $server2_data[0]->yabs[0]->ram_mb, 'MB') !!}
<td class="td-nowrap">{{$server2_data[0]->yabs[0]->ram_mb}}<span class="data-type">MB</span>
</td>
</tr> </tr>
<tr> <tr>
<td class="td-nowrap">Disk</td> <td class="td-nowrap">Disk</td>
<td class="td-nowrap">{{$server1_data[0]->disk_gb}}<span class="data-type">GB</span></td> <td class="td-nowrap">{{$server1_data[0]->yabs[0]->disk_gb}}<span
{!! \App\Models\Server::tableRowCompare($server1_data[0]->disk_gb, $server2_data[0]->disk_gb, 'GB') !!} class="data-type">GB</span></td>
<td class="td-nowrap">{{$server2_data[0]->disk_gb}}<span class="data-type">GB</span></td> {!! \App\Models\Server::tableRowCompare($server1_data[0]->yabs[0]->disk_gb, $server2_data[0]->yabs[0]->disk_gb, 'GB') !!}
<td class="td-nowrap">{{$server2_data[0]->yabs[0]->disk_gb}}<span
class="data-type">GB</span></td>
</tr> </tr>
<tr> <tr>
<td class="td-nowrap">GB5 single</td> <td class="td-nowrap">GB5 single</td>
<td class="td-nowrap">{{$server1_data[0]->gb5_single}}</td> <td class="td-nowrap">{{$server1_data[0]->yabs[0]->gb5_single}}</td>
{!! \App\Models\Server::tableRowCompare($server1_data[0]->gb5_single, $server2_data[0]->gb5_single, '') !!} {!! \App\Models\Server::tableRowCompare($server1_data[0]->yabs[0]->gb5_single, $server2_data[0]->yabs[0]->gb5_single, '') !!}
<td class="td-nowrap">{{$server2_data[0]->gb5_single}}</td> <td class="td-nowrap">{{$server2_data[0]->yabs[0]->gb5_single}}</td>
</tr> </tr>
<tr> <tr>
<td class="td-nowrap">GB5 multi</td> <td class="td-nowrap">GB5 multi</td>
<td class="td-nowrap">{{$server1_data[0]->gb5_multi}}</td> <td class="td-nowrap">{{$server1_data[0]->yabs[0]->gb5_multi}}</td>
{!! \App\Models\Server::tableRowCompare($server1_data[0]->gb5_multi, $server2_data[0]->gb5_multi, '') !!} {!! \App\Models\Server::tableRowCompare($server1_data[0]->yabs[0]->gb5_multi, $server2_data[0]->yabs[0]->gb5_multi, '') !!}
<td class="td-nowrap">{{$server2_data[0]->gb5_multi}}</td> <td class="td-nowrap">{{$server2_data[0]->yabs[0]->gb5_multi}}</td>
</tr> </tr>
<tr> <tr>
<td class="td-nowrap">4k disk</td> <td class="td-nowrap">4k disk</td>
<td class="td-nowrap">{{$server1_data[0]->d_4k_as_mbps}}<span class="data-type">MB/s</span> <td class="td-nowrap">{{$server1_data[0]->yabs[0]->disk_speed->d_4k_as_mbps}}<span
class="data-type">MB/s</span>
</td> </td>
{!! \App\Models\Server::tableRowCompare($server1_data[0]->d_4k_as_mbps, $server2_data[0]->d_4k_as_mbps, 'MB/s') !!} {!! \App\Models\Server::tableRowCompare($server1_data[0]->yabs[0]->disk_speed->d_4k_as_mbps, $server2_data[0]->yabs[0]->disk_speed->d_4k_as_mbps, 'MB/s') !!}
<td class="td-nowrap">{{$server2_data[0]->d_4k_as_mbps}}<span class="data-type">MB/s</span> <td class="td-nowrap">{{$server2_data[0]->yabs[0]->disk_speed->d_4k_as_mbps}}<span
class="data-type">MB/s</span>
</td> </td>
</tr> </tr>
<tr> <tr>
<td class="td-nowrap">64k disk</td> <td class="td-nowrap">64k disk</td>
<td class="td-nowrap">{{$server1_data[0]->d_64k_as_mbps}}<span class="data-type">MB/s</span> <td class="td-nowrap">{{$server1_data[0]->yabs[0]->disk_speed->d_64k_as_mbps}}<span
class="data-type">MB/s</span>
</td> </td>
{!! \App\Models\Server::tableRowCompare($server1_data[0]->d_64k_as_mbps, $server2_data[0]->d_64k_as_mbps, 'MB/s') !!} {!! \App\Models\Server::tableRowCompare($server1_data[0]->yabs[0]->disk_speed->d_64k_as_mbps, $server2_data[0]->yabs[0]->disk_speed->d_64k_as_mbps, 'MB/s') !!}
<td class="td-nowrap">{{$server2_data[0]->d_64k_as_mbps}}<span class="data-type">MB/s</span> <td class="td-nowrap">{{$server2_data[0]->yabs[0]->disk_speed->d_64k_as_mbps}}<span
class="data-type">MB/s</span>
</td> </td>
</tr> </tr>
<tr> <tr>
<td class="td-nowrap">512k disk</td> <td class="td-nowrap">512k disk</td>
<td class="td-nowrap">{{$server1_data[0]->d_512k_as_mbps}}<span <td class="td-nowrap">{{$server1_data[0]->yabs[0]->disk_speed->d_512k_as_mbps}}<span
class="data-type">MB/s</span></td> class="data-type">MB/s</span></td>
{!! \App\Models\Server::tableRowCompare($server1_data[0]->d_512k_as_mbps, $server2_data[0]->d_512k_as_mbps, 'MB/s') !!} {!! \App\Models\Server::tableRowCompare($server1_data[0]->yabs[0]->disk_speed->d_512k_as_mbps, $server2_data[0]->yabs[0]->disk_speed->d_512k_as_mbps, 'MB/s') !!}
<td class="td-nowrap">{{$server2_data[0]->d_512k_as_mbps}}<span <td class="td-nowrap">{{$server2_data[0]->yabs[0]->disk_speed->d_512k_as_mbps}}<span
class="data-type">MB/s</span></td> class="data-type">MB/s</span></td>
</tr> </tr>
<tr> <tr>
<td class="td-nowrap">1m disk</td> <td class="td-nowrap">1m disk</td>
<td class="td-nowrap">{{$server1_data[0]->d_1m_as_mbps}}<span class="data-type">MB/s</span> <td class="td-nowrap">{{$server1_data[0]->yabs[0]->disk_speed->d_1m_as_mbps}}<span
class="data-type">MB/s</span>
</td> </td>
{!! \App\Models\Server::tableRowCompare($server1_data[0]->d_1m_as_mbps, $server2_data[0]->d_1m_as_mbps, 'MB/s') !!} {!! \App\Models\Server::tableRowCompare($server1_data[0]->yabs[0]->disk_speed->d_1m_as_mbps, $server2_data[0]->yabs[0]->disk_speed->d_1m_as_mbps, 'MB/s') !!}
<td class="td-nowrap">{{$server2_data[0]->d_1m_as_mbps}}<span class="data-type">MB/s</span> <td class="td-nowrap">{{$server2_data[0]->yabs[0]->disk_speed->d_1m_as_mbps}}<span
class="data-type">MB/s</span>
</td> </td>
</tr> </tr>
<tr> @if($server1_data[0]->yabs[0]->network_speed[0]->location === $server2_data[0]->yabs[0]->network_speed[0]->location)
<td class="td-nowrap">{{$server1_network[0]->location}} send</td>
<td class="td-nowrap">{{$server1_network[0]->send_as_mbps}}<span
class="data-type">MBps</span></td>
{!! \App\Models\Server::tableRowCompare($server1_network[0]->send_as_mbps, $server2_network[0]->send_as_mbps, 'MBps') !!}
<td class="td-nowrap">{{$server2_network[0]->send_as_mbps}}<span
class="data-type">MBps</span></td>
</tr>
<tr>
<td class="td-nowrap">{{$server1_network[0]->location}} receive</td>
<td class="td-nowrap">{{$server1_network[0]->receive_as_mbps}}<span
class="data-type">MBps</span></td>
{!! \App\Models\Server::tableRowCompare($server1_network[0]->receive_as_mbps, $server2_network[0]->receive_as_mbps, 'MBps') !!}
<td class="td-nowrap">{{$server2_network[0]->receive_as_mbps}}<span
class="data-type">MBps</span></td>
</tr>
<tr>
<td class="td-nowrap">{{$server1_network[1]->location}} send</td>
<td class="td-nowrap">{{$server1_network[1]->send_as_mbps}}<span
class="data-type">MBps</span></td>
{!! \App\Models\Server::tableRowCompare($server1_network[1]->send_as_mbps, $server2_network[1]->send_as_mbps, 'MBps') !!}
<td class="td-nowrap">{{$server2_network[1]->send_as_mbps}}<span
class="data-type">MBps</span></td>
</tr>
@if($server1_network[0]->location === $server2_network[0]->location)
<tr> <tr>
<td class="td-nowrap">{{$server1_network[1]->location}} receive</td> <td class="td-nowrap">{{$server1_data[0]->yabs[0]->network_speed[0]->location}} send
<td class="td-nowrap">{{$server1_network[1]->receive_as_mbps}}<span class="data-type">MBps</span>
</td> </td>
{!! \App\Models\Server::tableRowCompare($server1_network[1]->receive_as_mbps, $server2_network[1]->receive_as_mbps, 'MBps') !!} <td class="td-nowrap">{{$server1_data[0]->yabs[0]->network_speed[0]->send_as_mbps}}
<td class="td-nowrap">{{$server2_network[1]->receive_as_mbps}}<span class="data-type">MBps</span> <span class="data-type">MBps</span>
</td>
{!! \App\Models\Server::tableRowCompare($server1_data[0]->yabs[0]->network_speed[0]->send_as_mbps, $server2_data[0]->yabs[0]->network_speed[0]->send_as_mbps, 'MBps') !!}
<td class="td-nowrap">{{$server2_data[0]->yabs[0]->network_speed[0]->send_as_mbps}}
<span class="data-type">MBps</span>
</td> </td>
</tr> </tr>
@endif @endif
@if($server1_network[1]->location === $server2_network[1]->location) @if($server1_data[0]->yabs[0]->network_speed[0]->location === $server2_data[0]->yabs[0]->network_speed[0]->location)
<tr> <tr>
<td class="td-nowrap">{{$server1_network[2]->location}} send</td> <td class="td-nowrap">{{$server1_data[0]->yabs[0]->network_speed[0]->location}} receive
<td class="td-nowrap">{{$server1_network[2]->send_as_mbps}}<span </td>
<td class="td-nowrap">{{$server1_data[0]->yabs[0]->network_speed[0]->receive_as_mbps}}
<span class="data-type">MBps</span>
</td>
{!! \App\Models\Server::tableRowCompare($server1_data[0]->yabs[0]->network_speed[0]->receive_as_mbps, $server2_data[0]->yabs[0]->network_speed[0]->receive_as_mbps, 'MBps') !!}
<td class="td-nowrap">{{$server2_data[0]->yabs[0]->network_speed[0]->receive_as_mbps}}
<span class="data-type">MBps</span>
</td>
</tr>
@endif
@if($server1_data[0]->yabs[0]->network_speed[1]->location === $server2_data[0]->yabs[0]->network_speed[1]->location)
<tr>
<td class="td-nowrap">{{$server1_data[0]->yabs[0]->network_speed[1]->location}} send
</td>
<td class="td-nowrap">{{$server1_data[0]->yabs[0]->network_speed[1]->send_as_mbps}}
<span class="data-type">MBps</span>
</td>
{!! \App\Models\Server::tableRowCompare($server1_data[0]->yabs[0]->network_speed[1]->send_as_mbps, $server2_data[0]->yabs[0]->network_speed[1]->send_as_mbps, 'MBps') !!}
<td class="td-nowrap">{{$server2_data[0]->yabs[0]->network_speed[1]->send_as_mbps}}
<span class="data-type">MBps</span>
</td>
</tr>
@endif
@if($server1_data[0]->yabs[0]->network_speed[1]->location === $server2_data[0]->yabs[0]->network_speed[1]->location)
<tr>
<td class="td-nowrap">{{$server1_data[0]->yabs[0]->network_speed[1]->location}} receive
</td>
<td class="td-nowrap">{{$server1_data[0]->yabs[0]->network_speed[1]->receive_as_mbps}}
<span class="data-type">MBps</span>
</td>
{!! \App\Models\Server::tableRowCompare($server1_data[0]->yabs[0]->network_speed[1]->receive_as_mbps, $server2_data[0]->yabs[0]->network_speed[1]->receive_as_mbps, 'MBps') !!}
<td class="td-nowrap">{{$server2_data[0]->yabs[0]->network_speed[1]->receive_as_mbps}}
<span class="data-type">MBps</span>
</td>
</tr>
@endif
@if($server1_data[0]->yabs[0]->network_speed[2]->location === $server2_data[0]->yabs[0]->network_speed[2]->location)
<tr>
<td class="td-nowrap">{{$server1_data[0]->yabs[0]->network_speed[2]->location}} send
</td>
<td class="td-nowrap">{{$server1_data[0]->yabs[0]->network_speed[2]->send_as_mbps}}
<span class="data-type">MBps</span>
</td>
{!! \App\Models\Server::tableRowCompare($server1_data[0]->yabs[0]->network_speed[2]->send_as_mbps, $server2_data[0]->yabs[0]->network_speed[2]->send_as_mbps, 'MBps') !!}
<td class="td-nowrap">{{$server2_data[0]->yabs[0]->network_speed[2]->send_as_mbps}}
<span class="data-type">MBps</span>
</td>
</tr>
@endif
@if($server1_data[0]->yabs[0]->network_speed[2]->location === $server2_data[0]->yabs[0]->network_speed[2]->location)
<tr>
<td class="td-nowrap">{{$server1_data[0]->yabs[0]->network_speed[2]->location}} receive
</td>
<td class="td-nowrap">{{$server1_data[0]->yabs[0]->network_speed[2]->receive_as_mbps}}
<span class="data-type">MBps</span>
</td>
{!! \App\Models\Server::tableRowCompare($server1_data[0]->yabs[0]->network_speed[2]->receive_as_mbps, $server2_data[0]->yabs[0]->network_speed[2]->receive_as_mbps, 'MBps') !!}
<td class="td-nowrap">{{$server2_data[0]->yabs[0]->network_speed[2]->receive_as_mbps}}
<span class="data-type">MBps</span>
</td>
</tr>
@endif
@if($server1_data[0]->yabs[0]->network_speed[3]->location === $server2_data[0]->yabs[0]->network_speed[3]->location)
<tr>
<td class="td-nowrap">{{$server1_data[0]->yabs[0]->network_speed[3]->location}} send
</td>
<td class="td-nowrap">{{$server1_data[0]->yabs[0]->network_speed[3]->send_as_mbps}}<span
class="data-type">MBps</span></td> class="data-type">MBps</span></td>
{!! \App\Models\Server::tableRowCompare($server1_network[2]->send_as_mbps, $server2_network[2]->send_as_mbps, 'MBps') !!} {!! \App\Models\Server::tableRowCompare($server1_data[0]->yabs[0]->network_speed[3]->send_as_mbps, $server2_data[0]->yabs[0]->network_speed[3]->send_as_mbps, 'MBps') !!}
<td class="td-nowrap">{{$server2_network[2]->send_as_mbps}}<span <td class="td-nowrap">{{$server2_data[0]->yabs[0]->network_speed[3]->send_as_mbps}}<span
class="data-type">MBps</span></td> class="data-type">MBps</span></td>
</tr> </tr>
@endif @endif
@if($server1_network[2]->location === $server2_network[2]->location) @if($server1_data[0]->yabs[0]->network_speed[3]->location === $server2_data[0]->yabs[0]->network_speed[3]->location)
<tr> <tr>
<td class="td-nowrap">{{$server1_network[2]->location}} receive</td> <td class="td-nowrap">{{$server1_data[0]->yabs[0]->network_speed[3]->location}} receive
<td class="td-nowrap">{{$server1_network[2]->receive_as_mbps}}<span class="data-type">MBps</span>
</td> </td>
{!! \App\Models\Server::tableRowCompare($server1_network[2]->receive_as_mbps, $server2_network[2]->receive_as_mbps, 'MBps') !!} <td class="td-nowrap">{{$server1_data[0]->yabs[0]->network_speed[3]->receive_as_mbps}}
<td class="td-nowrap">{{$server2_network[2]->receive_as_mbps}}<span class="data-type">MBps</span> <span class="data-type">MBps</span>
</td>
{!! \App\Models\Server::tableRowCompare($server1_data[0]->yabs[0]->network_speed[3]->receive_as_mbps, $server2_data[0]->yabs[0]->network_speed[3]->receive_as_mbps, 'MBps') !!}
<td class="td-nowrap">{{$server2_data[0]->yabs[0]->network_speed[3]->receive_as_mbps}}
<span class="data-type">MBps</span>
</td>
</tr>
@endif
@if($server1_data[0]->yabs[0]->network_speed[4]->location === $server2_data[0]->yabs[0]->network_speed[4]->location)
<tr>
<td class="td-nowrap">{{$server1_data[0]->yabs[0]->network_speed[4]->location}} send
</td>
<td class="td-nowrap">{{$server1_data[0]->yabs[0]->network_speed[4]->send_as_mbps}}<span
class="data-type">MBps</span></td>
{!! \App\Models\Server::tableRowCompare($server1_data[0]->yabs[0]->network_speed[4]->send_as_mbps, $server2_data[0]->yabs[0]->network_speed[4]->send_as_mbps, 'MBps') !!}
<td class="td-nowrap">{{$server2_data[0]->yabs[0]->network_speed[4]->send_as_mbps}}<span
class="data-type">MBps</span></td>
</tr>
@endif
@if($server1_data[0]->yabs[0]->network_speed[4]->location === $server2_data[0]->yabs[0]->network_speed[4]->location)
<tr>
<td class="td-nowrap">{{$server1_data[0]->yabs[0]->network_speed[4]->location}} receive
</td>
<td class="td-nowrap">{{$server1_data[0]->yabs[0]->network_speed[4]->receive_as_mbps}}
<span class="data-type">MBps</span>
</td>
{!! \App\Models\Server::tableRowCompare($server1_data[0]->yabs[0]->network_speed[4]->receive_as_mbps, $server2_data[0]->yabs[0]->network_speed[4]->receive_as_mbps, 'MBps') !!}
<td class="td-nowrap">{{$server2_data[0]->yabs[0]->network_speed[4]->receive_as_mbps}}
<span class="data-type">MBps</span>
</td> </td>
</tr> </tr>
@endif @endif
<tr> <tr>
<td class="td-nowrap">USD p/m</td> <td class="td-nowrap">USD p/m</td>
<td class="td-nowrap">{{$server1_data[0]->usd_per_month}}<span class="data-type">p/m</span> <td class="td-nowrap">{{$server1_data[0]->price->usd_per_month}}<span
class="data-type">p/m</span>
</td> </td>
{!! \App\Models\Server::tableRowCompare($server1_data[0]->usd_per_month, $server2_data[0]->usd_per_month, 'p/m') !!} {!! \App\Models\Server::tableRowCompare($server1_data[0]->price->usd_per_month, $server2_data[0]->price->usd_per_month, 'p/m') !!}
<td class="td-nowrap">{{$server2_data[0]->usd_per_month}}<span class="data-type">p/m</span> <td class="td-nowrap">{{$server2_data[0]->price->usd_per_month}}<span
class="data-type">p/m</span>
</td> </td>
</tr> </tr>
<tr> <tr>
<td class="td-nowrap">Actual price</td> <td class="td-nowrap">Actual price</td>
<td class="td-nowrap">{{$server1_data[0]->price}}<span <td class="td-nowrap">{{$server1_data[0]->price->price}}<span
class="data-type">{{$server1_data[0]->currency}}</span> {{\App\Process::paymentTermIntToString($server1_data[0]->term)}} class="data-type">{{$server1_data[0]->currency}}</span> {{\App\Process::paymentTermIntToString($server1_data[0]->price->term)}}
</td> </td>
<td class="td-nowrap equal-td"></td> <td class="td-nowrap equal-td"></td>
<td class="td-nowrap">{{$server2_data[0]->price}}<span <td class="td-nowrap">{{$server2_data[0]->price->price}}<span
class="data-type">{{$server2_data[0]->currency}}</span> {{\App\Process::paymentTermIntToString($server2_data[0]->term)}} class="data-type">{{$server2_data[0]->price->currency}}</span> {{\App\Process::paymentTermIntToString($server2_data[0]->price->term)}}
</td> </td>
</tr> </tr>
<tr> <tr>
<td class="td-nowrap">CPU per USD</td> <td class="td-nowrap">CPU per USD</td>
<td class="td-nowrap">{{number_format($server1_data[0]->cpu_cores / $server1_data[0]->usd_per_month,2)}}</td> <td class="td-nowrap">{{number_format($server1_data[0]->yabs[0]->cpu_cores / $server1_data[0]->price->usd_per_month,2)}}</td>
{!! \App\Models\Server::tableRowCompare($server1_data[0]->cpu_cores / $server1_data[0]->usd_per_month, $server2_data[0]->cpu_cores / $server2_data[0]->usd_per_month, '') !!} {!! \App\Models\Server::tableRowCompare($server1_data[0]->yabs[0]->cpu_cores / $server1_data[0]->price->usd_per_month, $server2_data[0]->yabs[0]->cpu_cores / $server2_data[0]->price->usd_per_month, '') !!}
<td class="td-nowrap">{{number_format($server2_data[0]->cpu_cores / $server2_data[0]->usd_per_month,2)}}</td> <td class="td-nowrap">{{number_format($server2_data[0]->yabs[0]->cpu_cores / $server2_data[0]->price->usd_per_month,2)}}</td>
</tr> </tr>
<tr> <tr>
<td class="td-nowrap">Disk GB per USD</td> <td class="td-nowrap">Disk GB per USD</td>
<td class="td-nowrap">{{number_format($server1_data[0]->disk_gb / $server1_data[0]->usd_per_month,2)}}</td> <td class="td-nowrap">{{number_format($server1_data[0]->yabs[0]->disk_gb / $server1_data[0]->price->usd_per_month,2)}}</td>
{!! \App\Models\Server::tableRowCompare($server1_data[0]->disk_gb / $server1_data[0]->usd_per_month, $server2_data[0]->disk_gb / $server2_data[0]->usd_per_month, '') !!} {!! \App\Models\Server::tableRowCompare($server1_data[0]->yabs[0]->disk_gb / $server1_data[0]->price->usd_per_month, $server2_data[0]->yabs[0]->disk_gb / $server2_data[0]->price->usd_per_month, '') !!}
<td class="td-nowrap">{{number_format($server2_data[0]->disk_gb / $server2_data[0]->usd_per_month,2)}}</td> <td class="td-nowrap">{{number_format($server2_data[0]->yabs[0]->disk_gb / $server2_data[0]->price->usd_per_month,2)}}</td>
</tr> </tr>
<tr> <tr>
<td class="td-nowrap">Ram MB per USD</td> <td class="td-nowrap">Ram MB per USD</td>
<td class="td-nowrap">{{number_format($server1_data[0]->ram_mb / $server1_data[0]->usd_per_month,2)}}</td> <td class="td-nowrap">{{number_format($server1_data[0]->yabs[0]->ram_mb / $server1_data[0]->price->usd_per_month,2)}}</td>
{!! \App\Models\Server::tableRowCompare($server1_data[0]->ram_mb / $server1_data[0]->usd_per_month, $server2_data[0]->ram_mb / $server2_data[0]->usd_per_month, '') !!} {!! \App\Models\Server::tableRowCompare($server1_data[0]->yabs[0]->ram_mb / $server1_data[0]->price->usd_per_month, $server2_data[0]->yabs[0]->ram_mb / $server2_data[0]->price->usd_per_month, '') !!}
<td class="td-nowrap">{{number_format($server2_data[0]->ram_mb / $server2_data[0]->usd_per_month,2)}}</td> <td class="td-nowrap">{{number_format($server2_data[0]->yabs[0]->ram_mb / $server2_data[0]->price->usd_per_month,2)}}</td>
</tr> </tr>
<tr> <tr>
<td class="td-nowrap">GB5 single per USD</td> <td class="td-nowrap">GB5 single per USD</td>
<td class="td-nowrap">{{number_format($server1_data[0]->gb5_single / $server1_data[0]->usd_per_month,2)}}</td> <td class="td-nowrap">{{number_format($server1_data[0]->yabs[0]->gb5_single / $server1_data[0]->price->usd_per_month,2)}}</td>
{!! \App\Models\Server::tableRowCompare($server1_data[0]->gb5_single / $server1_data[0]->usd_per_month, $server2_data[0]->gb5_single / $server2_data[0]->usd_per_month, '') !!} {!! \App\Models\Server::tableRowCompare($server1_data[0]->yabs[0]->gb5_single / $server1_data[0]->price->usd_per_month, $server2_data[0]->yabs[0]->gb5_single / $server2_data[0]->price->usd_per_month, '') !!}
<td class="td-nowrap">{{number_format($server2_data[0]->gb5_single / $server2_data[0]->usd_per_month,2)}}</td> <td class="td-nowrap">{{number_format($server2_data[0]->yabs[0]->gb5_single / $server2_data[0]->price->usd_per_month,2)}}</td>
</tr> </tr>
<tr> <tr>
<td class="td-nowrap">GB5 multi per USD</td> <td class="td-nowrap">GB5 multi per USD</td>
<td class="td-nowrap">{{number_format($server1_data[0]->gb5_multi / $server1_data[0]->usd_per_month,2)}}</td> <td class="td-nowrap">{{number_format($server1_data[0]->yabs[0]->gb5_multi / $server1_data[0]->price->usd_per_month,2)}}</td>
{!! \App\Models\Server::tableRowCompare($server1_data[0]->gb5_multi / $server1_data[0]->usd_per_month, $server2_data[0]->gb5_multi / $server2_data[0]->usd_per_month, '') !!} {!! \App\Models\Server::tableRowCompare($server1_data[0]->yabs[0]->gb5_multi / $server1_data[0]->price->usd_per_month, $server2_data[0]->yabs[0]->gb5_multi / $server2_data[0]->price->usd_per_month, '') !!}
<td class="td-nowrap">{{number_format($server2_data[0]->gb5_multi / $server2_data[0]->usd_per_month,2)}}</td> <td class="td-nowrap">{{number_format($server2_data[0]->yabs[0]->gb5_multi / $server2_data[0]->price->usd_per_month,2)}}</td>
</tr> </tr>
<tr> <tr>
<td class="td-nowrap">Location</td> <td class="td-nowrap">Location</td>
<td class="td-nowrap">{{$server1_data[0]->location}}</td> <td class="td-nowrap">{{$server1_data[0]->location->name}}</td>
<td class="td-nowrap equal-td"></td> <td class="td-nowrap equal-td"></td>
<td class="td-nowrap">{{$server2_data[0]->location}}</td> <td class="td-nowrap">{{$server2_data[0]->location->name}}</td>
</tr> </tr>
<tr> <tr>
<td class="td-nowrap">Provider</td> <td class="td-nowrap">Provider</td>
<td class="td-nowrap">{{$server1_data[0]->provider_name}}</td> <td class="td-nowrap">{{$server1_data[0]->provider->name}}</td>
<td class="td-nowrap equal-td"></td> <td class="td-nowrap equal-td"></td>
<td class="td-nowrap">{{$server2_data[0]->provider_name}}</td> <td class="td-nowrap">{{$server2_data[0]->provider->name}}</td>
</tr> </tr>
<tr> <tr>
<td class="td-nowrap">Owned since</td> <td class="td-nowrap">Owned since</td>

View File

@ -1,7 +1,9 @@
@section('title') {{$server[0]->hostname}} {{'edit'}} @endsection @section('title')
{{$server_data->hostname}} {{'edit'}}
@endsection
<x-app-layout> <x-app-layout>
<x-slot name="header"> <x-slot name="header">
Edit {{ $server[0]->hostname }} Edit {{ $server_data->hostname }}
</x-slot> </x-slot>
<div class="container"> <div class="container">
<x-card class="shadow mt-3"> <x-card class="shadow mt-3">
@ -11,18 +13,18 @@
Back to servers Back to servers
</x-back-button> </x-back-button>
<x-errors-alert></x-errors-alert> <x-errors-alert></x-errors-alert>
<form action="{{ route('servers.update', $server[0]->service_id) }}" method="POST"> <form action="{{ route('servers.update', $server_data->id) }}" method="POST">
@csrf @csrf
@method('PUT') @method('PUT')
<div class="row mt-3"> <div class="row mt-3">
<div class="col-12 col-lg-6 mb-4"> <div class="col-12 col-lg-6 mb-4">
<input type="hidden" value="{{$server[0]->service_id}}" name="server_id"> <input type="hidden" value="{{$server_data->id}}" name="server_id">
<div class="input-group"> <div class="input-group">
<div class="input-group-prepend"><span class="input-group-text">Hostname</span></div> <div class="input-group-prepend"><span class="input-group-text">Hostname</span></div>
<input type="text" <input type="text"
class="form-control" class="form-control"
name="hostname" name="hostname"
value="{{ $server[0]->hostname }}"> value="{{ $server_data->hostname }}">
@error('name') <span class="text-red-500">{{ $message }} @error('name') <span class="text-red-500">{{ $message }}
</span>@enderror </span>@enderror
</div> </div>
@ -40,7 +42,7 @@
</div> </div>
<div class="col-12 col-lg-3 mb-4"> <div class="col-12 col-lg-3 mb-4">
<x-os-select> <x-os-select>
<x-slot name="current">{{$server[0]->os_id}}</x-slot> <x-slot name="current">{{$server_data->os_id}}</x-slot>
</x-os-select> </x-os-select>
</div> </div>
</div> </div>
@ -50,7 +52,7 @@
<x-slot name="title">NS1</x-slot> <x-slot name="title">NS1</x-slot>
<x-slot name="name">ns1</x-slot> <x-slot name="name">ns1</x-slot>
<x-slot name="max">255</x-slot> <x-slot name="max">255</x-slot>
<x-slot name="value">{{ $server[0]->ns1 }}</x-slot> <x-slot name="value">{{ $server_data->ns1 }}</x-slot>
</x-text-input> </x-text-input>
</div> </div>
<div class="col-12 col-lg-3 mb-4"> <div class="col-12 col-lg-3 mb-4">
@ -58,7 +60,7 @@
<x-slot name="title">NS2</x-slot> <x-slot name="title">NS2</x-slot>
<x-slot name="name">ns2</x-slot> <x-slot name="name">ns2</x-slot>
<x-slot name="max">255</x-slot> <x-slot name="max">255</x-slot>
<x-slot name="value">{{ $server[0]->ns2 }}</x-slot> <x-slot name="value">{{ $server_data->ns2 }}</x-slot>
</x-text-input> </x-text-input>
</div> </div>
</div> </div>
@ -67,18 +69,18 @@
<div class="input-group"> <div class="input-group">
<div class="input-group-prepend"><span class="input-group-text">Virt</span></div> <div class="input-group-prepend"><span class="input-group-text">Virt</span></div>
<select class="form-control" name="server_type"> <select class="form-control" name="server_type">
<option value="1" {{ ($server[0]->server_type === 1) ? 'selected' : '' }}>KVM <option value="1" {{ ($server_data->server_type === 1) ? 'selected' : '' }}>KVM
</option> </option>
<option value="2" {{ ($server[0]->server_type === 2) ? 'selected' : '' }}>OVZ <option value="2" {{ ($server_data->server_type === 2) ? 'selected' : '' }}>OVZ
</option> </option>
<option value="3" {{ ($server[0]->server_type === 3) ? 'selected' : '' }}>DEDI <option value="3" {{ ($server_data->server_type === 3) ? 'selected' : '' }}>DEDI
</option> </option>
<option value="4" {{ ($server[0]->server_type === 4) ? 'selected' : '' }}>LXC <option value="4" {{ ($server_data->server_type === 4) ? 'selected' : '' }}>LXC
</option> </option>
<option value="5" {{ ($server[0]->server_type === 5) ? 'selected' : '' }}> <option value="5" {{ ($server_data->server_type === 5) ? 'selected' : '' }}>
SEMI-DEDI SEMI-DEDI
</option> </option>
<option value="6" {{ ($server[0]->server_type === 6) ? 'selected' : '' }}> <option value="6" {{ ($server_data->server_type === 6) ? 'selected' : '' }}>
VMware VMware
</option> </option>
</select></div> </select></div>
@ -90,7 +92,7 @@
<x-slot name="value">22</x-slot> <x-slot name="value">22</x-slot>
<x-slot name="max">999999</x-slot> <x-slot name="max">999999</x-slot>
<x-slot name="step">1</x-slot> <x-slot name="step">1</x-slot>
<x-slot name="value">{{ $server[0]->ssh }}</x-slot> <x-slot name="value">{{ $server_data->ssh }}</x-slot>
</x-number-input> </x-number-input>
</div> </div>
<div class="col-12 col-lg-3 mb-4"> <div class="col-12 col-lg-3 mb-4">
@ -100,28 +102,28 @@
<x-slot name="value">1000</x-slot> <x-slot name="value">1000</x-slot>
<x-slot name="max">99999</x-slot> <x-slot name="max">99999</x-slot>
<x-slot name="step">1</x-slot> <x-slot name="step">1</x-slot>
<x-slot name="value">{{ $server[0]->bandwidth }}</x-slot> <x-slot name="value">{{ $server_data->bandwidth }}</x-slot>
</x-number-input> </x-number-input>
</div> </div>
<div class="col-12 col-lg-3 mb-4"> <div class="col-12 col-lg-3 mb-4">
<x-yes-no-select> <x-yes-no-select>
<x-slot name="title">Promo price</x-slot> <x-slot name="title">Promo price</x-slot>
<x-slot name="name">was_promo</x-slot> <x-slot name="name">was_promo</x-slot>
<x-slot name="value">{{ $server[0]->was_promo }}</x-slot> <x-slot name="value">{{ $server_data->was_promo }}</x-slot>
</x-yes-no-select> </x-yes-no-select>
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="col-md-3 mb-3"> <div class="col-md-3 mb-3">
<x-providers-select> <x-providers-select>
<x-slot name="current">{{$server[0]->provider_id}}</x-slot> <x-slot name="current">{{$server_data->provider_id}}</x-slot>
</x-providers-select> </x-providers-select>
</div> </div>
<div class="col-md-3 mb-3"> <div class="col-md-3 mb-3">
<x-number-input> <x-number-input>
<x-slot name="title">Price</x-slot> <x-slot name="title">Price</x-slot>
<x-slot name="name">price</x-slot> <x-slot name="name">price</x-slot>
<x-slot name="value">{{$server[0]->price}}</x-slot> <x-slot name="value">{{$server_data->price->price}}</x-slot>
<x-slot name="max">9999</x-slot> <x-slot name="max">9999</x-slot>
<x-slot name="step">0.01</x-slot> <x-slot name="step">0.01</x-slot>
<x-slot name="required"></x-slot> <x-slot name="required"></x-slot>
@ -129,12 +131,12 @@
</div> </div>
<div class="col-md-3 mb-3"> <div class="col-md-3 mb-3">
<x-term-select> <x-term-select>
<x-slot name="current">{{$server[0]->term}}</x-slot> <x-slot name="current">{{$server_data->price->term}}</x-slot>
</x-term-select> </x-term-select>
</div> </div>
<div class="col-md-3 mb-3"> <div class="col-md-3 mb-3">
<x-currency-select> <x-currency-select>
<x-slot name="current">{{$server[0]->currency}}</x-slot> <x-slot name="current">{{$server_data->price->currency}}</x-slot>
</x-currency-select> </x-currency-select>
</div> </div>
</div> </div>
@ -144,7 +146,7 @@
<x-number-input> <x-number-input>
<x-slot name="title">CPU</x-slot> <x-slot name="title">CPU</x-slot>
<x-slot name="name">cpu</x-slot> <x-slot name="name">cpu</x-slot>
<x-slot name="value">{{$server[0]->cpu}}</x-slot> <x-slot name="value">{{$server_data->cpu}}</x-slot>
<x-slot name="max">64</x-slot> <x-slot name="max">64</x-slot>
<x-slot name="step">1</x-slot> <x-slot name="step">1</x-slot>
</x-number-input> </x-number-input>
@ -153,7 +155,7 @@
<x-number-input> <x-number-input>
<x-slot name="title">Ram</x-slot> <x-slot name="title">Ram</x-slot>
<x-slot name="name">ram</x-slot> <x-slot name="name">ram</x-slot>
<x-slot name="value">{{$server[0]->ram}}</x-slot> <x-slot name="value">{{$server_data->ram}}</x-slot>
<x-slot name="max">100000</x-slot> <x-slot name="max">100000</x-slot>
</x-number-input> </x-number-input>
</div> </div>
@ -161,14 +163,14 @@
<x-ram-type-select> <x-ram-type-select>
<x-slot name="title">Ram type</x-slot> <x-slot name="title">Ram type</x-slot>
<x-slot name="name">ram_type</x-slot> <x-slot name="name">ram_type</x-slot>
<x-slot name="value">{{$server[0]->ram_type}}</x-slot> <x-slot name="value">{{$server_data->ram_type}}</x-slot>
</x-ram-type-select> </x-ram-type-select>
</div> </div>
<div class="col-md-3 mb-3"> <div class="col-md-3 mb-3">
<x-number-input> <x-number-input>
<x-slot name="title">Disk</x-slot> <x-slot name="title">Disk</x-slot>
<x-slot name="name">disk</x-slot> <x-slot name="name">disk</x-slot>
<x-slot name="value">{{$server[0]->disk}}</x-slot> <x-slot name="value">{{$server_data->disk}}</x-slot>
<x-slot name="max">99999</x-slot> <x-slot name="max">99999</x-slot>
<x-slot name="step">0.1</x-slot> <x-slot name="step">0.1</x-slot>
</x-number-input> </x-number-input>
@ -177,28 +179,34 @@
<x-disk-type-select> <x-disk-type-select>
<x-slot name="title">Disk type</x-slot> <x-slot name="title">Disk type</x-slot>
<x-slot name="name">disk_type</x-slot> <x-slot name="name">disk_type</x-slot>
<x-slot name="value">{{$server[0]->disk_type}}</x-slot> <x-slot name="value">{{$server_data->disk_type}}</x-slot>
</x-disk-type-select> </x-disk-type-select>
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="col-12 col-md-4 mb-3"> <div class="col-12 col-md-4 mb-3">
<x-locations-select> <x-locations-select>
<x-slot name="current">{{$server[0]->location_id}}</x-slot> <x-slot name="current">{{$server_data->location_id}}</x-slot>
</x-locations-select> </x-locations-select>
</div> </div>
<div class="col-12 col-md-3 mb-3"> <div class="col-12 col-md-3 mb-3">
<x-date-input> <x-date-input>
<x-slot name="title">Owned since</x-slot> <x-slot name="title">Owned since</x-slot>
<x-slot name="name">owned_since</x-slot> <x-slot name="name">owned_since</x-slot>
<x-slot name="value">{{$server[0]->owned_since }}</x-slot> <x-slot name="value">{{$server_data->owned_since }}</x-slot>
</x-date-input> </x-date-input>
</div> </div>
<div class="col-12 col-md-3 mb-3"> <div class="col-12 col-md-3 mb-3">
<x-date-input> <x-date-input>
<x-slot name="title">Next due date</x-slot> <x-slot name="title">Next due date</x-slot>
<x-slot name="name">next_due_date</x-slot> <x-slot name="name">next_due_date</x-slot>
<x-slot name="value">{{$server[0]->next_due_date }}</x-slot> <x-slot name="value">
@if(isset($server_data->price->next_due_date))
{{$server_data->price->next_due_date}}
@else
{{\Carbon\Carbon::now()->addMonth(1)->format('Y-m-d')}}
@endif
</x-slot>
</x-date-input> </x-date-input>
</div> </div>
</div> </div>
@ -207,8 +215,8 @@
<x-labels-select> <x-labels-select>
<x-slot name="title">label</x-slot> <x-slot name="title">label</x-slot>
<x-slot name="name">label1</x-slot> <x-slot name="name">label1</x-slot>
@if(isset($labels[0]->id)) @if(isset($server_data->labels[0]->label->id))
<x-slot name="current">{{$labels[0]->id}}</x-slot> <x-slot name="current">{{$server_data->labels[0]->label->id}}</x-slot>
@endif @endif
</x-labels-select> </x-labels-select>
</div> </div>
@ -216,8 +224,8 @@
<x-labels-select> <x-labels-select>
<x-slot name="title">label</x-slot> <x-slot name="title">label</x-slot>
<x-slot name="name">label2</x-slot> <x-slot name="name">label2</x-slot>
@if(isset($labels[1]->id)) @if(isset($server_data->labels[1]->label->id))
<x-slot name="current">{{$labels[1]->id}}</x-slot> <x-slot name="current">{{$server_data->labels[1]->label->id}}</x-slot>
@endif @endif
</x-labels-select> </x-labels-select>
</div> </div>
@ -225,8 +233,8 @@
<x-labels-select> <x-labels-select>
<x-slot name="title">label</x-slot> <x-slot name="title">label</x-slot>
<x-slot name="name">label3</x-slot> <x-slot name="name">label3</x-slot>
@if(isset($labels[2]->id)) @if(isset($server_data->labels[2]->label->id))
<x-slot name="current">{{$labels[2]->id}}</x-slot> <x-slot name="current">{{$server_data->labels[2]->label->id}}</x-slot>
@endif @endif
</x-labels-select> </x-labels-select>
</div> </div>
@ -234,14 +242,14 @@
<x-labels-select> <x-labels-select>
<x-slot name="title">label</x-slot> <x-slot name="title">label</x-slot>
<x-slot name="name">label4</x-slot> <x-slot name="name">label4</x-slot>
@if(isset($labels[3]->id)) @if(isset($server_data->labels[3]->label->id))
<x-slot name="current">{{$labels[3]->id}}</x-slot> <x-slot name="current">{{$server_data->labels[3]->label->id}}</x-slot>
@endif @endif
</x-labels-select> </x-labels-select>
</div> </div>
</div> </div>
<div class="row"> <div class="row">
@foreach($ip_addresses as $ip) @foreach($server_data->ips as $ip)
<div class="col-12 col-lg-3 mb-4"> <div class="col-12 col-lg-3 mb-4">
<x-text-input> <x-text-input>
<x-slot name="title">IP</x-slot> <x-slot name="title">IP</x-slot>
@ -256,7 +264,7 @@
<div class="col-12 col-lg-6 mb-4"> <div class="col-12 col-lg-6 mb-4">
<div class="form-check"> <div class="form-check">
<input class="form-check-input" name="is_active" type="checkbox" <input class="form-check-input" name="is_active" type="checkbox"
value="1" {{ ($server[0]->active === 1) ? 'checked' : '' }}> value="1" {{ ($server_data->active === 1) ? 'checked' : '' }}>
<label class="form-check-label"> <label class="form-check-label">
I still have this server I still have this server
</label> </label>
@ -265,7 +273,7 @@
<div class="col-12 col-lg-6 mb-4"> <div class="col-12 col-lg-6 mb-4">
<div class="form-check"> <div class="form-check">
<input class="form-check-input" name="show_public" type="checkbox" <input class="form-check-input" name="show_public" type="checkbox"
value="1" {{ ($server[0]->show_public === 1) ? 'checked' : '' }}> value="1" {{ ($server_data->show_public === 1) ? 'checked' : '' }}>
<label class="form-check-label"> <label class="form-check-label">
Allow this data to be public <a href="{{route('settings.index')}}">restrict values Allow this data to be public <a href="{{route('settings.index')}}">restrict values
here</a> here</a>

View File

@ -59,7 +59,7 @@
<td class="text-center"> <td class="text-center">
{{ App\Models\Server::serviceServerType($server->server_type) }} {{ App\Models\Server::serviceServerType($server->server_type) }}
</td> </td>
<td class="text-center">{!!App\Models\Server::osIntToIcon($server->os_id, $server->os_name)!!}</td> <td class="text-center">{!!App\Models\Server::osIntToIcon($server->os->id, $server->os->name)!!}</td>
<td class="text-center">{{$server->cpu}}</td> <td class="text-center">{{$server->cpu}}</td>
<td class="text-center"> <td class="text-center">
@if(isset($server->ram)) @if(isset($server->ram))
@ -75,9 +75,9 @@
{{$server->disk}}<small>GB</small> {{$server->disk}}<small>GB</small>
@endif @endif
</td> </td>
<td class="text-nowrap">{{ $server->location }}</td> <td class="text-nowrap">{{ $server->location->name }}</td>
<td class="text-nowrap">{{ $server->provider_name }}</td> <td class="text-nowrap">{{ $server->provider->name }}</td>
<td class="text-nowrap">{{ $server->price }} {{$server->currency}} {{\App\Process::paymentTermIntToString($server->term)}}</td> <td class="text-nowrap">{{ $server->price->price }} {{$server->price->currency}} {{\App\Process::paymentTermIntToString($server->price->term)}}</td>
<td class="text-nowrap"> <td class="text-nowrap">
{{now()->diffInDays(Carbon\Carbon::parse($server->next_due_date))}} {{now()->diffInDays(Carbon\Carbon::parse($server->next_due_date))}}
<small>days</small></td> <small>days</small></td>
@ -144,7 +144,7 @@
<td class="text-center"> <td class="text-center">
{{ App\Models\Server::serviceServerType($server->server_type) }} {{ App\Models\Server::serviceServerType($server->server_type) }}
</td> </td>
<td class="text-center">{!!App\Models\Server::osIntToIcon($server->os_id, $server->os_name)!!}</td> <td class="text-center">{!!App\Models\Server::osIntToIcon($server->os->id, $server->os->name)!!}</td>
<td class="text-center">{{$server->cpu}}</td> <td class="text-center">{{$server->cpu}}</td>
<td class="text-center"> <td class="text-center">
@if($server->ram_as_mb > 1024) @if($server->ram_as_mb > 1024)
@ -160,9 +160,9 @@
{{$server->disk}}<small>GB</small> {{$server->disk}}<small>GB</small>
@endif @endif
</td> </td>
<td class="text-nowrap">{{ $server->location }}</td> <td class="text-nowrap">{{ $server->location->name }}</td>
<td class="text-nowrap">{{ $server->provider_name }}</td> <td class="text-nowrap">{{ $server->provider->name }}</td>
<td class="text-nowrap">{{ $server->price }} {{$server->currency}} {{\App\Process::paymentTermIntToString($server->term)}}</td> <td class="text-nowrap">{{ $server->price->price }} {{$server->price->currency}} {{\App\Process::paymentTermIntToString($server->price->term)}}</td>
<td class="text-center"> {{ $server->owned_since }}</td> <td class="text-center"> {{ $server->owned_since }}</td>
<td class="text-nowrap"> <td class="text-nowrap">
<form action="{{ route('servers.destroy', $server->id) }}" method="POST"> <form action="{{ route('servers.destroy', $server->id) }}" method="POST">

View File

@ -46,12 +46,12 @@
<td class="text-center"> <td class="text-center">
{{ App\Models\Server::serviceServerType($s->server_type) }} {{ App\Models\Server::serviceServerType($s->server_type) }}
</td> </td>
<td class="text-center">{!!App\Models\Server::osIntToIcon($s->os_id, $s->os_name)!!}</td> <td class="text-center">{!!App\Models\Server::osIntToIcon($s->os->id, $s->os->name)!!}</td>
<td class="text-center">{{$s->cpu}}</td> <td class="text-center">{{$s->cpu}}</td>
<td class="text-nowrap">{{$s->cpu_freq}}</td> <td class="text-nowrap">{{$s->yabs[0]->cpu_freq}}</td>
<td class="text-nowrap"> <td class="text-nowrap">
@if(isset($s->ram)) @if(isset($s->yabs[0]->ram))
{{ $s->ram}}<small>{{ $s->ram_type}}</small> {{ $s->yabs[0]->ram}}<small>{{ $s->yabs[0]->ram_type}}</small>
@else @else
{{$s->ram_as_mb}}<small>MB</small> {{$s->ram_as_mb}}<small>MB</small>
@endif @endif
@ -65,52 +65,52 @@
</td> </td>
<td class="text-nowrap"> <td class="text-nowrap">
@if(Session::get('show_server_value_location') === 1) @if(Session::get('show_server_value_location') === 1)
{{ $s->location }} {{ $s->location->name }}
@endif</td> @endif</td>
<td class="text-nowrap"> <td class="text-nowrap">
@if(Session::get('show_server_value_provider') === 1) @if(Session::get('show_server_value_provider') === 1)
{{ $s->provider_name }} {{ $s->provider->name }}
@endif @endif
</td> </td>
<td class="text-nowrap">{{ $s->price }} {{$s->currency}} {{\App\Process::paymentTermIntToString($s->term)}}</td> <td class="text-nowrap">{{ $s->price->price }} {{$s->currency}} {{\App\Process::paymentTermIntToString($s->price->term)}}</td>
<td class="text-nowrap"> {{ $s->owned_since }}</td> <td class="text-nowrap"> {{ $s->owned_since }}</td>
<td class="text-nowrap"> <td class="text-nowrap">
@if(Session::get('show_server_value_yabs') === 1) @if(Session::get('show_server_value_yabs') === 1)
{{$s->gb5_single}} {{$s->yabs[0]->gb5_single}}
@endif @endif
</td> </td>
<td class="text-nowrap"> <td class="text-nowrap">
@if(Session::get('show_server_value_yabs') === 1) @if(Session::get('show_server_value_yabs') === 1)
{{$s->gb5_multi}} {{$s->yabs[0]->gb5_multi}}
@endif @endif
</td> </td>
<td class="text-nowrap"> <td class="text-nowrap">
@if(Session::get('show_server_value_yabs') === 1) @if(Session::get('show_server_value_yabs') === 1)
{{$s->d_4k}}<small>{{$s->d_4k_type}}</small> {{$s->yabs[0]->disk_speed->d_4k}}<small>{{$s->yabs[0]->disk_speed->d_4k_type}}</small>
@endif @endif
</td> </td>
<td class="text-nowrap"> <td class="text-nowrap">
@if(Session::get('show_server_value_yabs') === 1) @if(Session::get('show_server_value_yabs') === 1)
{{$s->d_64k}}<small>{{$s->d_64k_type}}</small> {{$s->yabs[0]->disk_speed->d_64k}}<small>{{$s->yabs[0]->disk_speed->d_64k_type}}</small>
@endif @endif
</td> </td>
<td class="text-nowrap"> <td class="text-nowrap">
@if(Session::get('show_server_value_yabs') === 1) @if(Session::get('show_server_value_yabs') === 1)
{{$s->d_512k}}<small>{{$s->d_512k_type}}</small> {{$s->yabs[0]->disk_speed->d_512k}}<small>{{$s->yabs[0]->disk_speed->d_512k_type}}</small>
@endif</td> @endif</td>
<td class="text-nowrap"> <td class="text-nowrap">
@if(Session::get('show_server_value_yabs') === 1) @if(Session::get('show_server_value_yabs') === 1)
{{$s->d_1m}}<small>{{$s->d_1m_type}}</small> {{$s->yabs[0]->disk_speed->d_1m}}<small>{{$s->yabs[0]->disk_speed->d_1m_type}}</small>
@endif</td> @endif</td>
@if(Session::get('show_server_value_ip') === 1) @if(Session::get('show_server_value_ip') === 1)
<td class="text-nowrap"> <td class="text-nowrap">
@if($s->is_ipv4 === 1) @if($s->ips[0]->is_ipv4 === 1)
{{ $s->ip }} {{ $s->ips[0]->address }}
@endif @endif
</td> </td>
<td class="text-nowrap"> <td class="text-nowrap">
@if($s->is_ipv4 === 0) @if($s->ips[0]->is_ipv6 === 1)
{{ $s->ip }} {{ $s->ips[0]->address }}
@endif @endif
</td> </td>
@endif @endif

View File

@ -1,4 +1,6 @@
@section('title') {{$server->hostname}} {{'server'}} @endsection @section('title')
{{$server_data->hostname}} {{'server'}}
@endsection
<x-app-layout> <x-app-layout>
<x-slot name="header"> <x-slot name="header">
{{ __('Server details') }} {{ __('Server details') }}
@ -7,18 +9,14 @@
<x-card class="shadow mt-3"> <x-card class="shadow mt-3">
<div class="row"> <div class="row">
<div class="col-12 col-md-6 mb-2"> <div class="col-12 col-md-6 mb-2">
<h2>{{ $server->hostname }}</h2> <h2>{{ $server_data->hostname }}</h2>
<code>@foreach($labels as $label) @foreach($server_data->labels as $label)
@if($loop->last) <span class="badge bg-primary mx-1">{{$label->label->label}}</span>
{{$label->label}} @endforeach
@else
{{$label->label}},
@endif
@endforeach</code>
</div> </div>
<div class="col-12 col-md-6 text-md-end"> <div class="col-12 col-md-6 text-md-end">
<h6 class="text-muted pe-lg-4">{{ $server->id }}</h6> <h6 class="text-muted pe-lg-4">{{ $server_data->id }}</h6>
@if($server->active !== 1) @if($server_data->active !== 1)
<h6 class="text-danger pe-lg-4">not active</h6> <h6 class="text-danger pe-lg-4">not active</h6>
@endif @endif
</div> </div>
@ -31,65 +29,65 @@
<tr> <tr>
<td class="px-2 py-2 font-bold text-muted">Type</td> <td class="px-2 py-2 font-bold text-muted">Type</td>
<td> <td>
{{ $server->serviceServerType($server->server_type) }} {{ $server_data->serviceServerType($server_data->server_type) }}
</td> </td>
</tr> </tr>
<tr> <tr>
<td class="px-2 py-2 font-bold text-muted">OS</td> <td class="px-2 py-2 font-bold text-muted">OS</td>
<td>{{ $server_extras[0]->os_name }}</td> <td>{{ $server_data->os->name }}</td>
</tr> </tr>
<tr> <tr>
<td class="px-2 py-2 font-bold text-muted">Location</td> <td class="px-2 py-2 font-bold text-muted">Location</td>
<td>{{$server_extras[0]->location}}</td> <td>{{$server_data->location->name}}</td>
</tr> </tr>
<tr> <tr>
<td class="px-2 py-2 font-bold text-muted">Provider</td> <td class="px-2 py-2 font-bold text-muted">Provider</td>
<td>{{$server_extras[0]->provider}}</td> <td>{{$server_data->provider->name}}</td>
</tr> </tr>
<tr> <tr>
<td class="px-2 py-2 font-bold text-muted">Price</td> <td class="px-2 py-2 font-bold text-muted">Price</td>
<td>{{ $server_extras[0]->price }} {{ $server_extras[0]->currency }} <td>{{ $server_data->price->price }} {{ $server_data->price->currency }}
<small>{{\App\Process::paymentTermIntToString($server_extras[0]->term)}}</small> <small>{{\App\Process::paymentTermIntToString($server_data->price->term)}}</small>
</td> </td>
</tr> </tr>
<tr> <tr>
<td class="px-2 py-2 font-bold text-muted">Next due date</td> <td class="px-2 py-2 font-bold text-muted">Next due date</td>
<td>{{Carbon\Carbon::parse($server_extras[0]->next_due_date)->diffForHumans()}} <td>{{Carbon\Carbon::parse($server_data->price->next_due_date)->diffForHumans()}}
({{Carbon\Carbon::parse($server_extras[0]->next_due_date)->format('d/m/Y')}}) ({{Carbon\Carbon::parse($server_data->price->next_due_date)->format('d/m/Y')}})
</td> </td>
</tr> </tr>
<tr> <tr>
<td class="px-2 py-2 font-bold text-muted">CPU</td> <td class="px-2 py-2 font-bold text-muted">CPU</td>
<td> <td>
{{ $server_extras[0]->cpu }} @if($server_extras[0]->has_yabs) {{ $server_data->cpu }} @if($server_data->has_yabs)
<small>@</small> {{ $server_extras[0]->cpu_freq }} Mhz <small>@</small> {{ $server_data->yabs[0]->cpu_freq }} Mhz
@endif</td> @endif</td>
</tr> </tr>
<tr> <tr>
<td class="px-2 py-2 font-bold text-muted">RAM</td> <td class="px-2 py-2 font-bold text-muted">RAM</td>
<td> <td>
@if(isset($server_extras[0]->ram)) @if(isset($server_data->yabs[0]->ram))
{{ $server_extras[0]->ram }} {{ $server_extras[0]->ram_type }} {{ $server_data->yabs[0]->ram }} {{ $server_data->yabs[0]->ram_type }}
@else @else
{{ $server->ram }} {{ $server->ram_type }} {{ $server_data->ram }} {{ $server_data->ram_type }}
@endif @endif
</td> </td>
</tr> </tr>
<tr> <tr>
<td class="px-2 py-2 font-bold text-muted">Disk</td> <td class="px-2 py-2 font-bold text-muted">Disk</td>
<td> <td>
@if(isset($server_extras[0]->disk)) @if(isset($server_data->yabs[0]->disk))
{{ $server_extras[0]->disk }} {{ $server_extras[0]->disk_type }} {{ $server_data->yabs[0]->disk }} {{ $server_data->yabs[0]->disk_type }}
@else @else
{{ $server->disk }} {{ $server->disk_type }} {{ $server_data->disk }} {{ $server_data->disk_type }}
@endif @endif
</td> </td>
</tr> </tr>
<tr> <tr>
<td class="px-2 py-2 font-bold text-muted">Bandwidth</td> <td class="px-2 py-2 font-bold text-muted">Bandwidth</td>
<td>{{ $server_extras[0]->bandwidth }} GB</td> <td>{{ $server_data->bandwidth }} GB</td>
</tr> </tr>
@foreach($ip_addresses as $ip) @foreach($server_data->ips as $ip)
<tr> <tr>
<td class="px-2 py-2 font-bold text-muted">@if($ip['is_ipv4']) <td class="px-2 py-2 font-bold text-muted">@if($ip['is_ipv4'])
IPv4 IPv4
@ -102,29 +100,29 @@
@endforeach @endforeach
<tr> <tr>
<td class="px-2 py-2 font-bold text-muted">Was promo</td> <td class="px-2 py-2 font-bold text-muted">Was promo</td>
<td>{{ ($server_extras[0]->was_promo === 1) ? 'Yes' : 'No' }}</td> <td>{{ ($server_data->was_promo === 1) ? 'Yes' : 'No' }}</td>
</tr> </tr>
<tr> <tr>
<td class="px-2 py-2 font-bold text-muted">Owned since</td> <td class="px-2 py-2 font-bold text-muted">Owned since</td>
<td> <td>
@if(!is_null($server->owned_since)) @if(!is_null($server_data->owned_since))
{{ date_format(new DateTime($server->owned_since), 'jS F Y') }} {{ date_format(new DateTime($server_data->owned_since), 'jS F Y') }}
@endif @endif
</td> </td>
</tr> </tr>
<tr> <tr>
<td class="px-2 py-2 font-bold text-muted">Inserted</td> <td class="px-2 py-2 font-bold text-muted">Inserted</td>
<td> <td>
@if(!is_null($server->created_at)) @if(!is_null($server_data->created_at))
{{ date_format(new DateTime($server->created_at), 'jS M y g:i a') }} {{ date_format(new DateTime($server_data->created_at), 'jS M y g:i a') }}
@endif @endif
</td> </td>
</tr> </tr>
<tr> <tr>
<td class="px-2 py-2 font-bold text-muted">Updated</td> <td class="px-2 py-2 font-bold text-muted">Updated</td>
<td> <td>
@if(!is_null($server->updated_at)) @if(!is_null($server_data->updated_at))
{{ date_format(new DateTime($server->updated_at), 'jS M y g:i a') }} {{ date_format(new DateTime($server_data->updated_at), 'jS M y g:i a') }}
@endif @endif
</td> </td>
</tr> </tr>
@ -135,60 +133,64 @@
class="btn btn-success btn-sm mx-2"> class="btn btn-success btn-sm mx-2">
Go back Go back
</a> </a>
<a href="{{ route('servers.edit', $server->id) }}" <a href="{{ route('servers.edit', $server_data->id) }}"
class="btn btn-primary btn-sm mx-2"> class="btn btn-primary btn-sm mx-2">
Edit Edit
</a> </a>
</div> </div>
<div class="col-12 col-lg-6"> <div class="col-12 col-lg-6">
@if($server_extras[0]->has_yabs) @if($server_data->has_yabs)
<div class="table-responsive"> <div class="table-responsive">
<table class="table table-borderless text-nowrap"> <table class="table table-borderless text-nowrap">
<tbody> <tbody>
<tr> <tr>
<td class="px-2 py-2 font-bold text-muted">GB5 Single/Multi</td> <td class="px-2 py-2 font-bold text-muted">GB5 Single/Multi</td>
<td> <td>
{{$server_extras[0]->gb5_single}} / {{$server_extras[0]->gb5_multi}} {{$server_data->yabs[0]->gb5_single}} / {{$server_data->yabs[0]->gb5_multi}}
</td> </td>
</tr> </tr>
<tr> <tr>
<td class="px-2 py-2 font-bold text-muted">CPU</td> <td class="px-2 py-2 font-bold text-muted">CPU</td>
<td>{{$server_extras[0]->cpu_model}}</td> <td>{{$server_data->yabs[0]->cpu_model}}</td>
</tr> </tr>
<tr> <tr>
<td class="px-2 py-2 font-bold text-muted">AES</td> <td class="px-2 py-2 font-bold text-muted">AES</td>
<td>{{ ($server_extras[0]->aes === 1) ? 'Yes' : 'No' }}</td> <td>{{ ($server_data->yabs[0]->aes === 1) ? 'Yes' : 'No' }}</td>
</tr> </tr>
<tr> <tr>
<td class="px-2 py-2 font-bold text-muted">VM</td> <td class="px-2 py-2 font-bold text-muted">VM</td>
<td>{{ ($server_extras[0]->vm === 1) ? 'Yes' : 'No' }}</td> <td>{{ ($server_data->yabs[0]->vm === 1) ? 'Yes' : 'No' }}</td>
</tr> </tr>
<tr> <tr>
<td class="px-2 py-2 font-bold text-muted">Disk 4k</td> <td class="px-2 py-2 font-bold text-muted">Disk 4k</td>
<td>{{$server_extras[0]->d_4k}} <small>{{$server_extras[0]->d_4k_type}}</small></td> <td>{{$server_data->yabs[0]->disk_speed->d_4k}}
<small>{{$server_data->yabs[0]->disk_speed->d_4k_type}}</small></td>
</tr> </tr>
<tr> <tr>
<td class="px-2 py-2 font-bold text-muted">Disk 64k</td> <td class="px-2 py-2 font-bold text-muted">Disk 64k</td>
<td>{{$server_extras[0]->d_64k}} <small>{{$server_extras[0]->d_64k_type}}</small> <td>{{$server_data->yabs[0]->disk_speed->d_64k}}
<small>{{$server_data->yabs[0]->disk_speed->d_64k_type}}</small>
</td> </td>
</tr> </tr>
<tr> <tr>
<td class="px-2 py-2 font-bold text-muted">Disk 512k</td> <td class="px-2 py-2 font-bold text-muted">Disk 512k</td>
<td>{{$server_extras[0]->d_512k}} <small>{{$server_extras[0]->d_512k_type}}</small> <td>{{$server_data->yabs[0]->disk_speed->d_512k}}
<small>{{$server_data->yabs[0]->disk_speed->d_512k_type}}</small>
</td> </td>
</tr> </tr>
<tr> <tr>
<td class="px-2 py-2 font-bold text-muted">Disk 1m</td> <td class="px-2 py-2 font-bold text-muted">Disk 1m</td>
<td>{{$server_extras[0]->d_1m}} <small>{{$server_extras[0]->d_1m_type}}</small></td> <td>{{$server_data->yabs[0]->disk_speed->d_1m}}
<small>{{$server_data->yabs[0]->disk_speed->d_1m_type}}</small></td>
</tr> </tr>
<tr> <tr>
<td class="px-2 py-2 font-bold">Network speed (s/r)</td> <td class="px-2 py-2 font-bold">Network speed (s/r)</td>
</tr> </tr>
@foreach($network_speeds as $ns) @foreach($server_data->yabs[0]->network_speed as $ns)
<tr> <tr>
<td class="px-2 py-2 font-bold text-muted">{{$ns['location']}}</td> <td class="px-2 py-2 font-bold text-muted">{{$ns->location}}</td>
<td>{{$ns['send']}} <small>{{$ns['send_type']}}</small> {{$ns['receive']}} <td>{{$ns->send}} <small>{{$ns->send_type}}</small> {{$ns->receive}}
<small>{{$ns['receive_type']}}</small></td> <small>{{$ns->receive_type}}</small></td>
</tr> </tr>
@endforeach @endforeach
</tbody> </tbody>