From eb31701076be35d44a56a128be2d56775409ba9c Mon Sep 17 00:00:00 2001 From: cp6 Date: Tue, 19 Jul 2022 15:55:10 +1000 Subject: [PATCH 01/14] Updated Reseller model to use relationships Updated Reseller model to use relationships Added caching for Reseller --- app/Http/Controllers/ResellerController.php | 45 ++++------- app/Models/Reseller.php | 50 +++++++----- resources/views/reseller/edit.blade.php | 86 ++++++++++----------- resources/views/reseller/index.blade.php | 16 ++-- resources/views/reseller/show.blade.php | 30 ++++--- resources/views/shared/edit.blade.php | 82 ++++++++++---------- 6 files changed, 151 insertions(+), 158 deletions(-) diff --git a/app/Http/Controllers/ResellerController.php b/app/Http/Controllers/ResellerController.php index 075fc72..399a3c6 100644 --- a/app/Http/Controllers/ResellerController.php +++ b/app/Http/Controllers/ResellerController.php @@ -18,16 +18,13 @@ class ResellerController extends Controller { public function index() { - $resellers = Reseller::resellerDataIndexPage(); - + $resellers = Reseller::allResellerHosting(); return view('reseller.index', compact(['resellers'])); } public function create() { - $Providers = Providers::allProviders(); - $Locations = Locations::allLocations(); - return view('reseller.create', compact(['Providers', 'Locations'])); + return view('reseller.create'); } public function store(Request $request) @@ -60,9 +57,7 @@ class ResellerController extends Controller $reseller_id = Str::random(8); $pricing = new Pricing(); - $as_usd = $pricing->convertToUSD($request->price, $request->currency); - $pricing->insertPricing(3, $reseller_id, $request->currency, $request->price, $request->payment_term, $as_usd, $request->next_due_date); if (!is_null($request->dedicated_ip)) { @@ -91,32 +86,23 @@ class ResellerController extends Controller 'db_limit' => $request->db ]); + Cache::forget("all_reseller"); Home::homePageCacheForget(); return redirect()->route('reseller.index') ->with('success', 'Reseller hosting created Successfully.'); } - public function show(Reseller $reseller) { - $reseller_extras = Reseller::resellerDataShowPage($reseller->id); - - $labels = Labels::labelsForService($reseller->id); - - $ip_address = IPs::ipsForServer($reseller->id); - return view('reseller.show', compact(['reseller', 'reseller_extras', 'labels', 'ip_address'])); + $reseller = Reseller::resellerHosting($reseller->id)[0]; + return view('reseller.show', compact(['reseller'])); } public function edit(Reseller $reseller) { - $labels = Labels::labelsForService($reseller->id); - - $ip_address = IPs::ipsForServer($reseller->id); - - $reseller = Reseller::resellerDataEditPage($reseller->id); - - return view('reseller.edit', compact(['reseller', 'ip_address', 'labels'])); + $reseller = Reseller::resellerHosting($reseller->id)[0]; + return view('reseller.edit', compact(['reseller'])); } public function update(Request $request, Reseller $reseller) @@ -164,13 +150,10 @@ class ResellerController extends Controller ]); $pricing = new Pricing(); - $as_usd = $pricing->convertToUSD($request->price, $request->currency); - $pricing->updatePricing($request->id, $request->currency, $request->price, $request->payment_term, $as_usd, $request->next_due_date); Labels::deleteLabelsAssignedTo($request->id); - Labels::insertLabelsAssigned([$request->label1, $request->label2, $request->label3, $request->label4], $request->id); IPs::deleteIPsAssignedTo($request->id); @@ -179,6 +162,7 @@ class ResellerController extends Controller IPs::insertIP($request->id, $request->dedicated_ip); } + Cache::forget("reseller_hosting.{$request->id}"); Cache::forget("labels_for_service.{$request->id}"); Home::homePageCacheForget(); @@ -189,18 +173,19 @@ class ResellerController extends Controller public function destroy(Reseller $reseller) { - $id = $reseller->id; - $items = Reseller::find($id); - + $reseller_id = $reseller->id; + $items = Reseller::find($reseller_id); $items->delete(); $p = new Pricing(); - $p->deletePricing($id); + $p->deletePricing($reseller_id); - Labels::deleteLabelsAssignedTo($id); + Labels::deleteLabelsAssignedTo($reseller_id); - IPs::deleteIPsAssignedTo($id); + IPs::deleteIPsAssignedTo($reseller_id); + Cache::forget("all_reseller"); + Cache::forget("reseller_hosting.$reseller_id"); Home::homePageCacheForget(); return redirect()->route('reseller.index') diff --git a/app/Models/Reseller.php b/app/Models/Reseller.php index b3dfd31..df43c73 100644 --- a/app/Models/Reseller.php +++ b/app/Models/Reseller.php @@ -17,32 +17,44 @@ class Reseller extends Model public $incrementing = false; - public static function resellerDataIndexPage() - { - return DB::table('reseller_hosting as s') - ->join('providers as p', 's.provider_id', '=', 'p.id') - ->join('locations as l', 's.location_id', '=', 'l.id') - ->join('pricings as pr', 's.id', '=', 'pr.service_id') - ->get(['s.*', 'p.name as provider_name', 'pr.*', 'l.name as location']); + public static function allResellerHosting() + {//All reseller hosting and relationships (no using joins) + return Cache::remember("all_reseller", now()->addMonth(1), function () { + return Reseller::with(['location', 'provider', 'price', 'ips', 'labels', 'labels.label'])->get(); + }); } - public static function resellerDataShowPage(string $reseller_id) + public static function resellerHosting(string $shared_id) + {//Single reseller hosting and relationships (no using joins) + return Cache::remember("reseller_hosting.$shared_id", now()->addMonth(1), function () use ($shared_id) { + return Reseller::where('id', $shared_id) + ->with(['location', 'provider', 'price', 'ips', 'labels', 'labels.label'])->get(); + }); + } + + public function ips() { - return DB::table('reseller_hosting 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') - ->where('s.id', '=', $reseller_id) - ->get(['s.*', 'p.name as provider_name', 'l.name as location', 'pr.*']); + return $this->hasMany(IPs::class, 'service_id', 'id'); } - public static function resellerDataEditPage(string $reseller_id) + public function location() { - return DB::table('reseller_hosting as s') - ->join('pricings as p', 's.id', '=', 'p.service_id') - ->where('s.id', '=', $reseller_id) - ->get(['s.*', 'p.*']); + return $this->hasOne(Locations::class, 'id', 'location_id'); + } + public function provider() + { + return $this->hasOne(Providers::class, 'id', 'provider_id'); + } + + public function price() + { + return $this->hasOne(Pricing::class, 'service_id', 'id'); + } + + public function labels() + { + return $this->hasMany(LabelsAssigned::class, 'service_id', 'id'); } } diff --git a/resources/views/reseller/edit.blade.php b/resources/views/reseller/edit.blade.php index a7aaea2..8cee131 100644 --- a/resources/views/reseller/edit.blade.php +++ b/resources/views/reseller/edit.blade.php @@ -1,7 +1,7 @@ -@section('title') {{$reseller[0]->main_domain}} {{'edit'}} @endsection +@section('title') {{$reseller->main_domain}} {{'edit'}} @endsection - Edit {{ $reseller[0]->main_domain }} + Edit {{ $reseller->main_domain }}
@@ -12,7 +12,7 @@ Back to reseller hosting -
+ @csrf @method('PUT')
@@ -21,58 +21,58 @@
Domain
+ name="domain" value="{{$reseller->main_domain}}"> @error('name') {{ $message }} @enderror
- +
Type
@@ -84,21 +84,21 @@ dedicated_ip 255 @if(isset($ip_address[0]['address'])){{$ip_address[0]['address']}}@endif + name="value">@if(isset($reseller->ips[0]['address'])){{$reseller->ips[0]['address']}}@endif
- {{$reseller[0]->provider_id}} + {{$reseller->provider->id}}
Price price - {{$reseller[0]->price}} + {{$reseller->price->price}} 9999 0.01 @@ -106,40 +106,40 @@
- {{$reseller[0]->term}} + {{$reseller->price->term}}
- {{$reseller[0]->currency}} + {{$reseller->price->currency}}
- {{$reseller[0]->location_id}} + {{$reseller->location->id}}
Promo price was_promo - {{ $reseller[0]->was_promo }} + {{ $reseller->was_promo }}
Owned since owned_since - {{$reseller[0]->owned_since }} + {{$reseller->owned_since }}
Next due date next_due_date - {{$reseller[0]->next_due_date }} + {{$reseller->price->next_due_date }}
@@ -152,7 +152,7 @@ 1 999999 1 - {{$reseller[0]->accounts}} + {{$reseller->accounts}}
@@ -162,7 +162,7 @@ 1 999999 1 - {{$reseller[0]->domains_limit}} + {{$reseller->domains_limit}}
@@ -172,7 +172,7 @@ 1 999999 1 - {{$reseller[0]->subdomains_limit}} + {{$reseller->subdomains_limit}}
@@ -182,7 +182,7 @@ 1 999999 1 - {{$reseller[0]->disk_as_gb}} + {{$reseller->disk_as_gb}}
@@ -194,7 +194,7 @@ 1 999999 1 - {{$reseller[0]->email_limit}} + {{$reseller->email_limit}}
@@ -204,7 +204,7 @@ 1 999999 1 - {{$reseller[0]->bandwidth}} + {{$reseller->bandwidth}}
@@ -214,7 +214,7 @@ 1 999999 1 - {{$reseller[0]->ftp_limit}} + {{$reseller->ftp_limit}}
@@ -224,17 +224,17 @@ 1 999999 1 - {{$reseller[0]->db_limit}} + {{$reseller->db_limit}}
-
+
label label1 - @if(isset($labels[0]->id)) - {{$labels[0]->id}} + @if(isset($reseller->labels[0]->label->id)) + {{$reseller->labels[0]->label->id}} @endif
@@ -242,8 +242,8 @@ label label2 - @if(isset($labels[1]->id)) - {{$labels[1]->id}} + @if(isset($reseller->labels[1]->label->id)) + {{$reseller->labels[1]->label->id}} @endif
@@ -251,8 +251,8 @@ label label3 - @if(isset($labels[2]->id)) - {{$labels[2]->id}} + @if(isset($reseller->labels[2]->label->id)) + {{$reseller->labels[2]->label->id}} @endif
@@ -260,15 +260,15 @@ label label4 - @if(isset($labels[3]->id)) - {{$labels[3]->id}} + @if(isset($reseller->labels[3]->label->id)) + {{$reseller->labels[3]->label->id}} @endif
active === 1) ? 'checked' : '' }}> + value="1" {{ ($reseller->active === 1) ? 'checked' : '' }}> diff --git a/resources/views/reseller/index.blade.php b/resources/views/reseller/index.blade.php index 0b2b08f..47347a6 100644 --- a/resources/views/reseller/index.blade.php +++ b/resources/views/reseller/index.blade.php @@ -44,20 +44,20 @@ {{ $row->main_domain }} {{ $row->reseller_type }} {{ $row->accounts }} - {{ $row->location }} - {{ $row->provider_name }} + {{ $row->location->name }} + {{ $row->provider->name }} {{ $row->disk_as_gb }} GB - {{ $row->price }} {{$row->currency}} {{\App\Process::paymentTermIntToString($row->term)}} - {{Carbon\Carbon::parse($row->next_due_date)->diffForHumans()}} + {{ $row->price->price }} {{$row->price->currency}} {{\App\Process::paymentTermIntToString($row->price->term)}} + {{Carbon\Carbon::parse($row->price->next_due_date)->diffForHumans()}} {{ $row->owned_since }} - - + - + id="btn-{{$row->main_domain}}" title="{{$row->id}}"> diff --git a/resources/views/reseller/show.blade.php b/resources/views/reseller/show.blade.php index f3093ec..fd23e79 100644 --- a/resources/views/reseller/show.blade.php +++ b/resources/views/reseller/show.blade.php @@ -8,13 +8,9 @@

{{ $reseller->main_domain }}

- @foreach($labels as $label) - @if($loop->last) - {{$label->label}} - @else - {{$label->label}}, - @endif - @endforeach + @foreach($reseller->labels as $label) + {{$label->label->label}} + @endforeach
{{ $reseller->id }}
@@ -30,7 +26,7 @@ Type - {{ $reseller_extras[0]->reseller_type }} + {{ $reseller->reseller_type }} Main domain @@ -39,22 +35,22 @@ Location - {{ $reseller_extras[0]->location }} + {{ $reseller->location->name }} Provider - {{ $reseller_extras[0]->provider_name }} + {{ $reseller->provider->name }} Price - {{ $reseller_extras[0]->price }} {{ $reseller_extras[0]->currency }} - {{\App\Process::paymentTermIntToString($reseller_extras[0]->term)}} + {{ $reseller->price->price }} {{ $reseller->price->currency }} + {{\App\Process::paymentTermIntToString($reseller->price->term)}} Has dedicated IP? - @if(isset($ip_address[0]->address)) + @if(isset($reseller->ips[0]->address)) Yes @else No @@ -63,8 +59,8 @@ IP - @if(isset($ip_address[0]->address)) - {{$ip_address[0]->address}} + @if(isset($reseller->ips[0]->address)) + {{$reseller->ips[0]->address}} @endif @@ -78,8 +74,8 @@ Next due date - {{Carbon\Carbon::parse($reseller_extras[0]->next_due_date)->diffForHumans()}} - ({{Carbon\Carbon::parse($reseller_extras[0]->next_due_date)->format('d/m/Y')}}) + {{Carbon\Carbon::parse($reseller->price->next_due_date)->diffForHumans()}} + ({{Carbon\Carbon::parse($reseller->price->next_due_date)->format('d/m/Y')}}) diff --git a/resources/views/shared/edit.blade.php b/resources/views/shared/edit.blade.php index 10017fd..cba613e 100644 --- a/resources/views/shared/edit.blade.php +++ b/resources/views/shared/edit.blade.php @@ -1,7 +1,7 @@ -@section('title') {{$shared[0]->main_domain}} {{'edit'}} @endsection +@section('title') {{$shared->main_domain}} {{'edit'}} @endsection - Edit {{ $shared[0]->main_domain }} + Edit {{ $shared->main_domain }}
@@ -12,7 +12,7 @@ Back to shared hosting -
+ @csrf @method('PUT')
@@ -21,55 +21,55 @@
Domain
+ name="domain" value="{{$shared->main_domain}}"> @error('name') {{ $message }} @enderror
- +
Type
@@ -80,21 +80,21 @@ Dedicated IP dedicated_ip 255 - @if(isset($shared[0]->ips[0]->address)) {{$shared[0]->ips[0]->address}}@endif + @if(isset($shared->ips[0]->address)) {{$shared->ips[0]->address}}@endif
- {{$shared[0]->provider->id}} + {{$shared->provider->id}}
Price price - {{$shared[0]->price->price}} + {{$shared->price->price}} 9999 0.01 @@ -102,40 +102,40 @@
- {{$shared[0]->price->term}} + {{$shared->price->term}}
- {{$shared[0]->price->currency}} + {{$shared->price->currency}}
- {{$shared[0]->location->id}} + {{$shared->location->id}}
Promo price was_promo - {{ $shared[0]->was_promo }} + {{ $shared->was_promo }}
Owned since owned_since - {{$shared[0]->owned_since }} + {{$shared->owned_since }}
Next due date next_due_date - {{$shared[0]->price->next_due_date }} + {{$shared->price->next_due_date }}
@@ -148,7 +148,7 @@ 1 999999 1 - {{$shared[0]->domains_limit}} + {{$shared->domains_limit}}
@@ -158,7 +158,7 @@ 1 999999 1 - {{$shared[0]->subdomains_limit}} + {{$shared->subdomains_limit}}
@@ -168,7 +168,7 @@ 1 999999 1 - {{$shared[0]->disk_as_gb}} + {{$shared->disk_as_gb}}
@@ -178,7 +178,7 @@ 1 999999 1 - {{$shared[0]->email_limit}} + {{$shared->email_limit}}
@@ -190,7 +190,7 @@ 1 999999 1 - {{$shared[0]->bandwidth}} + {{$shared->bandwidth}}
@@ -200,7 +200,7 @@ 1 999999 1 - {{$shared[0]->ftp_limit}} + {{$shared->ftp_limit}}
@@ -210,7 +210,7 @@ 1 999999 1 - {{$shared[0]->db_limit}} + {{$shared->db_limit}}
@@ -219,8 +219,8 @@ label label1 - @if(isset($shared[0]->labels[0]->label->id)) - {{$shared[0]->labels[0]->label->id}} + @if(isset($shared->labels[0]->label->id)) + {{$shared->labels[0]->label->id}} @endif @@ -228,8 +228,8 @@ label label2 - @if(isset($shared[0]->labels[1]->label->id)) - {{$shared[0]->labels[1]->label->id}} + @if(isset($shared->labels[1]->label->id)) + {{$shared->labels[1]->label->id}} @endif @@ -237,8 +237,8 @@ label label3 - @if(isset($shared[0]->labels[2]->label->id)) - {{$shared[0]->labels[2]->label->id}} + @if(isset($shared->labels[2]->label->id)) + {{$shared->labels[2]->label->id}} @endif @@ -246,15 +246,15 @@ label label4 - @if(isset($shared[0]->labels[3]->label->id)) - {{$shared[0]->labels[3]->label->id}} + @if(isset($shared->labels[3]->label->id)) + {{$shared->labels[3]->label->id}} @endif
active === 1) ? 'checked' : '' }}> + value="1" {{ ($shared->active === 1) ? 'checked' : '' }}> From 36194efbd8bb60d8c35137c70f6c7fffc1415744 Mon Sep 17 00:00:00 2001 From: cp6 Date: Tue, 19 Jul 2022 15:55:37 +1000 Subject: [PATCH 02/14] Updated Shared for data index Updated Shared for data index --- app/Http/Controllers/SharedController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Http/Controllers/SharedController.php b/app/Http/Controllers/SharedController.php index 0a3f26e..6b824f9 100644 --- a/app/Http/Controllers/SharedController.php +++ b/app/Http/Controllers/SharedController.php @@ -97,7 +97,7 @@ class SharedController extends Controller public function edit(Shared $shared) { - $shared = Shared::sharedHosting($shared->id); + $shared = Shared::sharedHosting($shared->id)[0]; return view('shared.edit', compact(['shared'])); } From 88636b88c7e58f292c826b94dcb3d925073692ab Mon Sep 17 00:00:00 2001 From: cp6 Date: Wed, 20 Jul 2022 00:19:05 +1000 Subject: [PATCH 03/14] Updated Domains model for relationships Updated Domains model for relationships Added caching --- app/Http/Controllers/DomainsController.php | 31 ++++------ app/Models/Domains.php | 46 +++++++++------ resources/views/domains/edit.blade.php | 44 +++++++-------- resources/views/domains/index.blade.php | 14 ++--- resources/views/domains/show.blade.php | 66 +++++++++++----------- 5 files changed, 100 insertions(+), 101 deletions(-) diff --git a/app/Http/Controllers/DomainsController.php b/app/Http/Controllers/DomainsController.php index 1467c63..89b6ef7 100644 --- a/app/Http/Controllers/DomainsController.php +++ b/app/Http/Controllers/DomainsController.php @@ -14,20 +14,16 @@ use Illuminate\Support\Str; class DomainsController extends Controller { - public function index() { - $domains = Domains::domainsDataIndexPage(); - + $domains = Domains::allDomains(); return view('domains.index', compact(['domains'])); } public function show(Domains $domain) - { - $service_extras = Domains::domainsDataShowPage($domain->id); - $labels = Labels::labelsForService($domain->id); - - return view('domains.show', compact(['domain', 'service_extras', 'labels'])); + {//Need to modern + $domain_info = Domains::domain($domain->id)[0]; + return view('domains.show', compact(['domain_info'])); } public function create() @@ -46,11 +42,8 @@ class DomainsController extends Controller ]); $domain_id = Str::random(8); - $pricing = new Pricing(); - $as_usd = $pricing->convertToUSD($request->price, $request->currency); - $pricing->insertPricing(4, $domain_id, $request->currency, $request->price, $request->payment_term, $as_usd, $request->next_due_date); Domains::create([ @@ -66,6 +59,7 @@ class DomainsController extends Controller Labels::insertLabelsAssigned([$request->label1, $request->label2, $request->label3, $request->label4], $domain_id); + Cache::forget("all_domains"); Home::homePageCacheForget(); return redirect()->route('domains.index') @@ -74,11 +68,8 @@ class DomainsController extends Controller public function edit(Domains $domain) { - $domain_info = Domains::domainsDataEditPage($domain->id); - - $labels = Labels::labelsForService($domain->id); - - return view('domains.edit', compact(['domain', 'domain_info', 'labels'])); + $domain_info = Domains::domain($domain->id)[0]; + return view('domains.edit', compact(['domain_info'])); } public function update(Request $request, Domains $domain) @@ -91,9 +82,7 @@ class DomainsController extends Controller ]); $pricing = new Pricing(); - $as_usd = $pricing->convertToUSD($request->price, $request->currency); - $pricing->updatePricing($domain->id, $request->currency, $request->price, $request->payment_term, $as_usd, $request->next_due_date); $domain->update([ @@ -108,9 +97,10 @@ class DomainsController extends Controller ]); Labels::deleteLabelsAssignedTo($domain->id); - Labels::insertLabelsAssigned([$request->label1, $request->label2, $request->label3, $request->label4], $domain->id); + Cache::forget("all_domains"); + Cache::forget("domain.{$domain->id}"); Cache::forget("labels_for_service.{$domain->id}"); Home::homePageCacheForget(); @@ -121,7 +111,6 @@ class DomainsController extends Controller public function destroy(Domains $domain) { $items = Domains::find($domain->id); - $items->delete(); $p = new Pricing(); @@ -129,6 +118,8 @@ class DomainsController extends Controller Labels::deleteLabelsAssignedTo($domain->id); + Cache::forget("all_domains"); + Cache::forget("domain.{$domain->id}"); Home::homePageCacheForget(); return redirect()->route('domains.index') diff --git a/app/Models/Domains.php b/app/Models/Domains.php index 4e17810..72001eb 100644 --- a/app/Models/Domains.php +++ b/app/Models/Domains.php @@ -4,6 +4,7 @@ namespace App\Models; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; +use Illuminate\Support\Facades\Cache; use Illuminate\Support\Facades\DB; class Domains extends Model @@ -12,30 +13,39 @@ class Domains extends Model public $incrementing = false; + protected $table = 'domains'; + protected $fillable = ['id', 'domain', 'extension', 'ns1', 'ns2', 'ns3', 'price', 'currency', 'payment_term', 'owned_since', 'provider_id', 'next_due_date']; - public static function domainsDataIndexPage() - { - return DB::table('domains as d') - ->join('providers as p', 'd.provider_id', '=', 'p.id') - ->join('pricings as pr', 'd.id', '=', 'pr.service_id') - ->get(['d.*', 'p.name as provider_name', 'pr.*']); + + public static function allDomains() + {//All domains and relationships (no using joins) + return Cache::remember("all_domains", now()->addMonth(1), function () { + return Domains::with(['provider', 'price', 'labels', 'labels.label'])->get(); + }); } - public static function domainsDataShowPage(string $domain_id) - { - return DB::table('domains as d') - ->join('providers as p', 'd.provider_id', '=', 'p.id') - ->join('pricings as pr', 'd.id', '=', 'pr.service_id') - ->where('d.id', '=', $domain_id) - ->get(['d.*', 'p.name as provider_name', 'pr.*']); + public static function domain(string $domain_id) + {//Single domains and relationships (no using joins) + return Cache::remember("domain.$domain_id", now()->addMonth(1), function () use ($domain_id) { + return Domains::where('id', $domain_id) + ->with(['provider', 'price', 'labels', 'labels.label'])->get(); + }); } - public static function domainsDataEditPage(string $domain_id) + public function provider() { - return DB::table('domains as d') - ->join('pricings as pr', 'd.id', '=', 'pr.service_id') - ->where('d.id', '=', $domain_id) - ->get(['d.*', 'pr.*']); + return $this->hasOne(Providers::class, 'id', 'provider_id'); } + + public function price() + { + return $this->hasOne(Pricing::class, 'service_id', 'id'); + } + + public function labels() + { + return $this->hasMany(LabelsAssigned::class, 'service_id', 'id'); + } + } diff --git a/resources/views/domains/edit.blade.php b/resources/views/domains/edit.blade.php index f9ae1c4..d3d5681 100644 --- a/resources/views/domains/edit.blade.php +++ b/resources/views/domains/edit.blade.php @@ -1,7 +1,7 @@ @section('title') {{'Edit domain'}} @endsection - Edit {{ $domain->domain }}.{{ $domain->extension }} + Edit {{ $domain_info->domain }}.{{ $domain_info->extension }}
@@ -11,7 +11,7 @@ Go back - + @csrf @method('PUT')
@@ -22,7 +22,7 @@ + value="{{ $domain_info->domain }}"> @error('name') {{ $message }} @enderror
@@ -31,7 +31,7 @@ Extension extension - {{ $domain->extension }} + {{ $domain_info->extension }}
@@ -41,7 +41,7 @@ NS1 ns1 255 - {{$domain->ns1}} + {{$domain_info->ns1}}
@@ -49,7 +49,7 @@ NS2 ns2 255 - {{$domain->ns2}} + {{$domain_info->ns2}}
@@ -57,7 +57,7 @@ NS3 ns3 255 - {{$domain->ns3}} + {{$domain_info->ns3}}
@@ -65,7 +65,7 @@
- {{$domain->provider_id}} + {{$domain_info->provider->id}}
@@ -74,17 +74,17 @@ Price price 0.01 - {{ $domain_info[0]->price }} + {{ $domain_info->price->price }}
- {{$domain_info[0]->term}} + {{$domain_info->price->term}}
- {{$domain_info[0]->currency}} + {{$domain_info->price->currency}}
@@ -93,14 +93,14 @@ Owned since owned_since - {{$domain_info[0]->owned_since }} + {{$domain_info->owned_since }}
Next due date next_due_date - {{$domain_info[0]->next_due_date}} + {{$domain_info->price->next_due_date}}
@@ -110,8 +110,8 @@ label label1 - @if(isset($labels[0]->id)) - {{$labels[0]->id}} + @if(isset($domain_info->labels[0]->label)) + {{$domain_info->labels[0]->label->id}} @endif @@ -119,8 +119,8 @@ label label2 - @if(isset($labels[1]->id)) - {{$labels[1]->id}} + @if(isset($domain_info->labels[1]->label)) + {{$domain_info->labels[1]->label->id}} @endif @@ -128,8 +128,8 @@ label label3 - @if(isset($labels[2]->id)) - {{$labels[2]->id}} + @if(isset($domain_info->labels[2]->label)) + {{$domain_info->labels[2]->label->id}} @endif @@ -137,8 +137,8 @@ label label4 - @if(isset($labels[3]->id)) - {{$labels[3]->id}} + @if(isset($domain_info->labels[3]->label)) + {{$domain_info->labels[3]->label->id}} @endif @@ -146,7 +146,7 @@
active === 1) ? 'checked' : '' }}> + value="1" {{ ($domain_info->active === 1) ? 'checked' : '' }}> diff --git a/resources/views/domains/index.blade.php b/resources/views/domains/index.blade.php index a252d68..95d5bd5 100644 --- a/resources/views/domains/index.blade.php +++ b/resources/views/domains/index.blade.php @@ -34,22 +34,22 @@ {{ $domain->domain }}.{{$domain->extension}} {{ $domain->owned_since}} - {{ now()->diffInDays($domain->next_due_date) }} days + {{ now()->diffInDays($domain->price->next_due_date) }} days - {{ $domain->provider_name}} - {{ $domain->price }} {{$domain->currency}} + {{ $domain->provider->name}} + {{ $domain->price->price }} {{$domain->price->currency}} - - + - @csrf @method('DELETE') + id="btn-{{$domain->domain}}" title="{{$domain->id}}"> diff --git a/resources/views/domains/show.blade.php b/resources/views/domains/show.blade.php index 4e9faa2..0a72b69 100644 --- a/resources/views/domains/show.blade.php +++ b/resources/views/domains/show.blade.php @@ -1,4 +1,6 @@ -@section('title') {{ $domain->domain }}.{{$domain->extension}} {{'domain'}} @endsection +@section('title') + {{ $domain_info->domain }}.{{$domain_info->extension}} {{'domain'}} +@endsection {{ __('Domain details') }} @@ -7,18 +9,14 @@
-

{{ $domain->domain }}.{{$domain->extension}}

- @foreach($labels as $label) - @if($loop->last) - {{$label->label}} - @else - {{$label->label}}, - @endif - @endforeach +

{{ $domain_info->domain }}.{{$domain_info->extension}}

+ @foreach($domain_info->labels as $label) + {{$label->label->label}} + @endforeach
-
{{ $domain->id }}
- @if($domain->active !== 1) +
{{ $domain_info->id }}
+ @if($domain_info->active !== 1)
not active
@endif
@@ -30,57 +28,59 @@ Domain - {{ $domain->domain }}.{{$domain->extension}} + {{ $domain_info->domain }} + .{{$domain_info->extension}} Provider - {{ $service_extras[0]->provider_name }} + {{ $domain_info->provider->name }} Price - {{ $service_extras[0]->price }} {{ $service_extras[0]->currency }} - {{\App\Process::paymentTermIntToString($service_extras[0]->term)}} + {{ $domain_info->price->price }} {{ $domain_info->price->currency }} + {{\App\Process::paymentTermIntToString($domain_info->price->term)}} NS1 - {{ $domain->ns1 }} + {{ $domain_info->ns1 }} NS2 - {{ $domain->ns2 }} + {{ $domain_info->ns2 }} NS3 - {{ $domain->ns3 }} + {{ $domain_info->ns3 }} Owned since - @if(!is_null($domain->owned_since)) - {{ date_format(new DateTime($domain->owned_since), 'jS F Y') }} + @if(!is_null($domain_info->owned_since)) + {{ date_format(new DateTime($domain_info->owned_since), 'jS F Y') }} @endif Next due date - {{Carbon\Carbon::parse($service_extras[0]->next_due_date)->diffForHumans()}} - ({{Carbon\Carbon::parse($service_extras[0]->next_due_date)->format('d/m/Y')}}) + {{Carbon\Carbon::parse($domain_info->price->next_due_date)->diffForHumans()}} + ({{Carbon\Carbon::parse($domain_info->price->next_due_date)->format('d/m/Y')}}) Inserted - @if(!is_null($domain->created_at)) - {{ date_format(new DateTime($domain->created_at), 'jS M y g:i a') }} + @if(!is_null($domain_info->created_at)) + {{ date_format(new DateTime($domain_info->created_at), 'jS M y g:i a') }} @endif Updated - @if(!is_null($domain->updated_at)) - {{ date_format(new DateTime($domain->updated_at), 'jS M y g:i a') }} + @if(!is_null($domain_info->updated_at)) + {{ date_format(new DateTime($domain_info->updated_at), 'jS M y g:i a') }} @endif @@ -89,14 +89,12 @@
- - Go back - - - Edit - + + {{ route('domains.index') }} + + + {{ route('domains.edit', $domain_info->id) }} +
From e46b7b3c63e9d7fbdf1e294a74a3b72c116fa3d4 Mon Sep 17 00:00:00 2001 From: cp6 Date: Wed, 20 Jul 2022 00:19:43 +1000 Subject: [PATCH 04/14] Added back & edit icon button components Added back & edit icon button components --- resources/views/components/back-btn.blade.php | 4 ++++ resources/views/components/edit-btn.blade.php | 4 ++++ resources/views/reseller/show.blade.php | 14 ++++++-------- resources/views/servers/show.blade.php | 14 ++++++-------- resources/views/shared/show.blade.php | 14 ++++++-------- resources/views/yabs/show.blade.php | 7 +++---- 6 files changed, 29 insertions(+), 28 deletions(-) create mode 100644 resources/views/components/back-btn.blade.php create mode 100644 resources/views/components/edit-btn.blade.php diff --git a/resources/views/components/back-btn.blade.php b/resources/views/components/back-btn.blade.php new file mode 100644 index 0000000..245a480 --- /dev/null +++ b/resources/views/components/back-btn.blade.php @@ -0,0 +1,4 @@ + + + {{$text ?? 'Go back'}} + diff --git a/resources/views/components/edit-btn.blade.php b/resources/views/components/edit-btn.blade.php new file mode 100644 index 0000000..5e0f98c --- /dev/null +++ b/resources/views/components/edit-btn.blade.php @@ -0,0 +1,4 @@ + + + {{$text ?? 'Edit'}} + diff --git a/resources/views/reseller/show.blade.php b/resources/views/reseller/show.blade.php index fd23e79..78d7b25 100644 --- a/resources/views/reseller/show.blade.php +++ b/resources/views/reseller/show.blade.php @@ -138,14 +138,12 @@ - - Go back - - - Edit - + + {{ route('reseller.index') }} + + + {{ route('reseller.edit', $reseller->id) }} + @if(Session::has('timer_version_footer') && Session::get('timer_version_footer') === 1)

diff --git a/resources/views/servers/show.blade.php b/resources/views/servers/show.blade.php index 16833ad..b561031 100644 --- a/resources/views/servers/show.blade.php +++ b/resources/views/servers/show.blade.php @@ -129,14 +129,12 @@ - - Go back - - - Edit - + + {{ route('servers.index') }} + + + {{ route('servers.edit', $server_data->id) }} +

@if($server_data->has_yabs) diff --git a/resources/views/shared/show.blade.php b/resources/views/shared/show.blade.php index d1d274b..4cef2da 100644 --- a/resources/views/shared/show.blade.php +++ b/resources/views/shared/show.blade.php @@ -133,14 +133,12 @@
- - Go back - - - Edit - + + {{ route('shared.index') }} + + + {{ route('shared.edit', $shared->id) }} + @if(Session::has('timer_version_footer') && Session::get('timer_version_footer') === 1)

diff --git a/resources/views/yabs/show.blade.php b/resources/views/yabs/show.blade.php index 35f8475..ba1065a 100644 --- a/resources/views/yabs/show.blade.php +++ b/resources/views/yabs/show.blade.php @@ -5,10 +5,9 @@

- - {{ route('yabs.index') }} - Go back - + + {{ route('yabs.index') }} +
From b9aed757adc8afb171d7276cc024c328141856ed Mon Sep 17 00:00:00 2001 From: cp6 Date: Wed, 20 Jul 2022 00:20:15 +1000 Subject: [PATCH 05/14] Added YABs to Json output Added YABs to Json output Cleaned up old unused functions --- app/Http/Controllers/YabsController.php | 7 +++ app/Models/Yabs.php | 66 +++++++++++++++++-------- routes/web.php | 2 + 3 files changed, 55 insertions(+), 20 deletions(-) diff --git a/app/Http/Controllers/YabsController.php b/app/Http/Controllers/YabsController.php index 5658589..048f301 100644 --- a/app/Http/Controllers/YabsController.php +++ b/app/Http/Controllers/YabsController.php @@ -159,4 +159,11 @@ class YabsController extends Controller return view('yabs.compare', compact('yabs1_data', 'yabs2_data')); } + public function yabsToJson(Yabs $yab): array + { + $all_yabs = Yabs::yabs($yab->id)[0]; + return Yabs::buildYabsArray($all_yabs); + } + + } diff --git a/app/Models/Yabs.php b/app/Models/Yabs.php index 3010313..e15f0a6 100644 --- a/app/Models/Yabs.php +++ b/app/Models/Yabs.php @@ -17,28 +17,10 @@ class Yabs extends Model protected $fillable = ['id', 'server_id', 'has_ipv6', 'aes', 'vm', 'output_date', 'cpu_cores', 'cpu_freq', 'cpu_model', 'ram', 'ram_type', 'ram_mb', 'disk', 'disk_type', 'disk_gb', 'gb5_single', 'gb5_multi', 'gb5_id', '4k', '4k_type', '4k_as_mbps', '64k', '64k_type', '64k_as_mbps', '512k', '512k_type', '512k_as_mbps', '1m', '1m_type', '1m_as_mbps', 'location', 'send', 'send_type', 'send_as_mbps', 'receive', 'receive_type', 'receive_as_mbps']; - public static function networkSpeedsForServer(string $server_id) - { - return Cache::remember("network_speeds.$server_id", now()->addMonth(1), function () use ($server_id) { - return json_decode(DB::table('network_speed') - ->where('network_speed.server_id', '=', $server_id) - ->get(), true); - }); - } - - public static function serverCompareNetwork(string $yabs_id) - { - return Cache::remember("compare_network_speeds.$yabs_id", now()->addMonth(1), function () use ($yabs_id) { - return DB::table('network_speed') - ->where('id', '=', $yabs_id) - ->get(); - }); - } - public static function yabs(string $yabs_id) { 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']) + return self::where('id', $yabs_id)->with(['server', 'disk_speed', 'network_speed', 'server.location', 'server.provider']) ->get(); }); } @@ -46,7 +28,7 @@ class Yabs extends Model public static function allYabs() { return Cache::remember("all_yabs", now()->addMonth(1), function () { - return self::with(['server', 'disk_speed', 'network_speed']) + return self::with(['server', 'disk_speed', 'network_speed', 'server.location', 'server.provider']) ->get(); }); } @@ -66,4 +48,48 @@ class Yabs extends Model return $this->hasMany(NetworkSpeed::class, 'id', 'id'); } + public static function buildYabsArray($data): array + { + $speed_tests = []; + foreach ($data->network_speed as $ns) { + $speed_tests[] = array( + 'location' => $ns->location, + 'send' => $ns->send.' '.$ns->send_type, + 'receive' => $ns->receive.' '.$ns->receive_type, + ); + } + return array( + 'date_time' => $data->output_date, + 'location' => $data->server->location->name, + 'provider' => $data->server->provider->name, + 'cpu' => array( + 'cores' => $data->cpu_cores, + 'speed_mhz' => $data->cpu_freq, + 'model' => $data->cpu_model, + 'aes' => $data->aes === 1, + 'vm' => $data->vm === 1, + 'GB5_single' => $data->gb5_single, + 'GB5_multi' => $data->gb5_multi, + ), + 'ram' => array( + 'amount' => $data->ram.' '.$data->ram_type, + 'mb' => $data->ram_mb, + ), + 'disk' => array( + 'amount' => $data->disk.' '.$data->disk_type, + 'gb' => $data->disk_gb, + 'speed_tests' => array( + '4k' => $data->disk_speed->d_4k.' '.$data->disk_speed->d_4k_type, + '64k' => $data->disk_speed->d_64k.' '.$data->disk_speed->d_64k_type, + '512k' => $data->disk_speed->d_512k.' '.$data->disk_speed->d_512k_type, + '1m' => $data->disk_speed->d_1m.' '.$data->disk_speed->d_1m_type, + ), + ), + 'network' => array( + 'has_ipv6' => $data->has_ipv6 === 1, + 'speed_tests' => $speed_tests + ), + ); + } + } diff --git a/routes/web.php b/routes/web.php index 60697fe..b99ed60 100644 --- a/routes/web.php +++ b/routes/web.php @@ -70,6 +70,8 @@ Route::resource('shared', SharedController::class)->middleware(['auth']); Route::resource('yabs', YabsController::class)->middleware(['auth']); +Route::get('yabs/{yab}/json', 'App\Http\Controllers\YabsController@yabsToJson')->middleware(['auth'])->name('yabs.json'); + Route::get('yabs-compare-choose', 'App\Http\Controllers\YabsController@chooseYabsCompare')->middleware(['auth'])->name('yabs.compare-choose'); Route::get('yabs-compare/{yabs1}/{yabs2}', 'App\Http\Controllers\YabsController@compareYabs')->middleware(['auth'])->name('yabs.compare'); From 47bfcea4c8bb9dbe9a53c0f14455084d0faafc89 Mon Sep 17 00:00:00 2001 From: cp6 Date: Wed, 20 Jul 2022 12:51:45 +1000 Subject: [PATCH 06/14] Added more YABs value saving & YABs save txt setting Added more YABs value saving (uptime, distro, kernel and swap memory) Added setting for saving YABs output to txt yes/no --- app/Http/Controllers/SettingsController.php | 2 ++ app/Http/Controllers/YabsController.php | 8 ++++- app/Models/Settings.php | 1 + app/Models/Yabs.php | 25 +++++++++------ app/Process.php | 21 +++++++++---- ...07_20_011250_add_columns_to_yabs_table.php | 31 +++++++++++++++++++ ...20_015804_add_column_to_settings_table.php | 22 +++++++++++++ resources/views/settings/index.blade.php | 16 ++++++++++ 8 files changed, 110 insertions(+), 16 deletions(-) create mode 100644 database/migrations/2022_07_20_011250_add_columns_to_yabs_table.php create mode 100644 database/migrations/2022_07_20_015804_add_column_to_settings_table.php diff --git a/app/Http/Controllers/SettingsController.php b/app/Http/Controllers/SettingsController.php index c474492..9314c2d 100644 --- a/app/Http/Controllers/SettingsController.php +++ b/app/Http/Controllers/SettingsController.php @@ -30,6 +30,7 @@ class SettingsController extends Controller 'show_server_value_location' => 'required|boolean', 'show_server_value_price' => 'required|boolean', 'show_server_value_yabs' => 'required|boolean', + 'save_yabs_as_txt' => 'required|boolean', 'default_currency' => 'required', 'default_server_os' => 'required', 'due_soon_amount' => 'required|integer|between:0,12', @@ -49,6 +50,7 @@ class SettingsController extends Controller 'show_server_value_location' => $request->show_server_value_location, 'show_server_value_price' => $request->show_server_value_price, 'show_server_value_yabs' => $request->show_server_value_yabs, + 'save_yabs_as_txt' => $request->save_yabs_as_txt, 'default_currency' => $request->default_currency, 'default_server_os' => $request->default_server_os, 'due_soon_amount' => $request->due_soon_amount, diff --git a/app/Http/Controllers/YabsController.php b/app/Http/Controllers/YabsController.php index 048f301..4c2e6c6 100644 --- a/app/Http/Controllers/YabsController.php +++ b/app/Http/Controllers/YabsController.php @@ -52,12 +52,18 @@ class YabsController extends Controller 'ram' => $yabs['ram'], 'ram_type' => $yabs['ram_type'], 'ram_mb' => $yabs['ram_mb'], + 'swap' => $yabs['swap'], + 'swap_type' => $yabs['swap_type'], + 'swap_mb' => $yabs['swap_mb'], 'disk' => $yabs['disk'], 'disk_type' => $yabs['disk_type'], 'disk_gb' => $yabs['disk_gb'], 'gb5_single' => $yabs['GB5_single'], 'gb5_multi' => $yabs['GB5_mult'], - 'gb5_id' => $yabs['GB5_id'] + 'gb5_id' => $yabs['GB5_id'], + 'uptime' => $yabs['uptime'], + 'distro' => $yabs['distro'], + 'kernel' => $yabs['kernel'] ]); DiskSpeed::create([ diff --git a/app/Models/Settings.php b/app/Models/Settings.php index 300f66b..913d183 100644 --- a/app/Models/Settings.php +++ b/app/Models/Settings.php @@ -36,6 +36,7 @@ class Settings extends Model Session::put('show_server_value_yabs', $settings[0]->show_server_value_yabs ?? 0); Session::put('show_server_value_provider', $settings[0]->show_server_value_provider ?? 0); Session::put('show_server_value_location', $settings[0]->show_server_value_location ?? 0); + Session::put('save_yabs_as_txt', $settings[0]->save_yabs_as_txt ?? 0); Session::put('default_currency', $settings[0]->default_currency ?? 'USD'); Session::put('default_server_os', $settings[0]->default_server_os ?? 1); Session::put('due_soon_amount', $settings[0]->due_soon_amount ?? 6); diff --git a/app/Models/Yabs.php b/app/Models/Yabs.php index e15f0a6..130a4ac 100644 --- a/app/Models/Yabs.php +++ b/app/Models/Yabs.php @@ -15,7 +15,7 @@ class Yabs extends Model protected $table = 'yabs'; - protected $fillable = ['id', 'server_id', 'has_ipv6', 'aes', 'vm', 'output_date', 'cpu_cores', 'cpu_freq', 'cpu_model', 'ram', 'ram_type', 'ram_mb', 'disk', 'disk_type', 'disk_gb', 'gb5_single', 'gb5_multi', 'gb5_id', '4k', '4k_type', '4k_as_mbps', '64k', '64k_type', '64k_as_mbps', '512k', '512k_type', '512k_as_mbps', '1m', '1m_type', '1m_as_mbps', 'location', 'send', 'send_type', 'send_as_mbps', 'receive', 'receive_type', 'receive_as_mbps']; + protected $fillable = ['id', 'server_id', 'has_ipv6', 'aes', 'vm', 'output_date', 'cpu_cores', 'cpu_freq', 'cpu_model', 'ram', 'ram_type', 'ram_mb', 'disk', 'disk_type', 'disk_gb', 'gb5_single', 'gb5_multi', 'gb5_id', '4k', '4k_type', '4k_as_mbps', '64k', '64k_type', '64k_as_mbps', '512k', '512k_type', '512k_as_mbps', '1m', '1m_type', '1m_as_mbps', 'location', 'send', 'send_type', 'send_as_mbps', 'receive', 'receive_type', 'receive_as_mbps', 'uptime', 'distro', 'kernel', 'swap', 'swap_type', 'swap_mb']; public static function yabs(string $yabs_id) { @@ -54,14 +54,17 @@ class Yabs extends Model foreach ($data->network_speed as $ns) { $speed_tests[] = array( 'location' => $ns->location, - 'send' => $ns->send.' '.$ns->send_type, - 'receive' => $ns->receive.' '.$ns->receive_type, + 'send' => $ns->send . ' ' . $ns->send_type, + 'receive' => $ns->receive . ' ' . $ns->receive_type, ); } return array( 'date_time' => $data->output_date, 'location' => $data->server->location->name, 'provider' => $data->server->provider->name, + 'uptime' => $data->uptime, + 'distro' => $data->distro, + 'kernel' => $data->kernel, 'cpu' => array( 'cores' => $data->cpu_cores, 'speed_mhz' => $data->cpu_freq, @@ -72,17 +75,21 @@ class Yabs extends Model 'GB5_multi' => $data->gb5_multi, ), 'ram' => array( - 'amount' => $data->ram.' '.$data->ram_type, + 'amount' => $data->ram . ' ' . $data->ram_type, 'mb' => $data->ram_mb, + 'swap' => array( + 'amount' => $data->swap ?? null . ' ' . $data->swap_type ?? null, + 'mb' => $data->swap_mb ?? null, + ), ), 'disk' => array( - 'amount' => $data->disk.' '.$data->disk_type, + 'amount' => $data->disk . ' ' . $data->disk_type, 'gb' => $data->disk_gb, 'speed_tests' => array( - '4k' => $data->disk_speed->d_4k.' '.$data->disk_speed->d_4k_type, - '64k' => $data->disk_speed->d_64k.' '.$data->disk_speed->d_64k_type, - '512k' => $data->disk_speed->d_512k.' '.$data->disk_speed->d_512k_type, - '1m' => $data->disk_speed->d_1m.' '.$data->disk_speed->d_1m_type, + '4k' => $data->disk_speed->d_4k . ' ' . $data->disk_speed->d_4k_type, + '64k' => $data->disk_speed->d_64k . ' ' . $data->disk_speed->d_64k_type, + '512k' => $data->disk_speed->d_512k . ' ' . $data->disk_speed->d_512k_type, + '1m' => $data->disk_speed->d_1m . ' ' . $data->disk_speed->d_1m_type, ), ), 'network' => array( diff --git a/app/Process.php b/app/Process.php index 1c7e636..dc82dfb 100644 --- a/app/Process.php +++ b/app/Process.php @@ -3,6 +3,7 @@ namespace App; use Illuminate\Support\Facades\DB; +use Illuminate\Support\Facades\Session; use Illuminate\Support\Facades\Storage; class Process @@ -169,22 +170,24 @@ class Process public function yabsOutputAsJson(string $server_id, string $data_from_form): array { - $file_name = 'tempYabs.txt'; - $allowed_versions = ['v2021-12-28', 'v2022-02-18', 'v2022-04-30', 'v2022-05-06', 'v2022-06-11']; + $file_name = date('Y') . '/' . date('m') . '/' . time() . '.txt'; + Storage::disk('local')->put($file_name, $data_from_form); $file = Storage::disk('local')->get($file_name); if ($file) { $array = explode("\n", $file); - Storage::disk('local')->delete($file_name);//Delete file + if (!Session::get('save_yabs_as_txt')) {//Check if we want YABs txt to stay + Storage::disk('local')->delete($file_name);//Delete file + } } else { return array('error_id' => 10, 'error_message' => 'Issue writing/reading txt file'); } - //dd($array); + //dd($array);//Good for debugging the lines if (count($array) < 46) { return array('error_id' => 9, 'error_message' => 'Less than 46 lines'); @@ -213,6 +216,9 @@ class Process $io_6 = explode(' ', preg_replace('!\s+!', ' ', $array[33])); (str_contains($array[13], 'Enabled')) ? $aes_ni = true : $aes_ni = false; (str_contains($array[14], 'Enabled')) ? $vm_amd_v = true : $vm_amd_v = false; + $uptime = str_replace(["Uptime : ", "\r"], '', $array[10]); + $distro = str_replace(["Distro : ", "\r"], '', $array[18]); + $kernel = str_replace(["Kernel : ", "\r"], '', $array[19]); } else { $cpu = $this->trimRemoveR(str_replace(':', '', strstr($array[10], ': '))); $cpu_spec = explode(' ', strstr($array[11], ': '));//: 2 @ 3792.872 MHz @@ -304,7 +310,7 @@ class Process $gb_s = 60; $gb_m = 61; $gb_url = 62; - }elseif ($array[59] === "Geekbench 5 Benchmark Test:\r") { + } elseif ($array[59] === "Geekbench 5 Benchmark Test:\r") { //HAS ipv6 //Has full ipv4 & ipv6 network speed testing $has_ipv6 = true; @@ -397,7 +403,10 @@ class Process 'vm' => $vm_amd_v, 'GB5_single' => $geekbench_single, 'GB5_mult' => $geekbench_multi, - 'GB5_id' => $gb5_id + 'GB5_id' => $gb5_id, + 'uptime' => $uptime ?? null, + 'distro' => $distro ?? null, + 'kernel' => $kernel ?? null, ]; $output['disk_speed'] = $disk_test_arr; diff --git a/database/migrations/2022_07_20_011250_add_columns_to_yabs_table.php b/database/migrations/2022_07_20_011250_add_columns_to_yabs_table.php new file mode 100644 index 0000000..c89e1c8 --- /dev/null +++ b/database/migrations/2022_07_20_011250_add_columns_to_yabs_table.php @@ -0,0 +1,31 @@ +string('uptime')->nullable()->default(null)->after('gb5_id'); + $table->string('distro')->nullable()->default(null)->after('gb5_id'); + $table->string('kernel')->nullable()->default(null)->after('gb5_id'); + $table->float('swap')->nullable()->default(null)->after('ram_mb'); + $table->char('swap_type', 2)->nullable()->default(null)->after('ram_mb'); + $table->float('swap_mb')->nullable()->default(null)->after('ram_mb'); + }); + } + + public function down() + { + Schema::table('yabs', function (Blueprint $table) { + $table->dropColumn('uptime'); + $table->dropColumn('distro'); + $table->dropColumn('kernel'); + $table->dropColumn('swap'); + $table->dropColumn('swap_type', 2); + $table->dropColumn('swap_mb'); + }); + } +}; diff --git a/database/migrations/2022_07_20_015804_add_column_to_settings_table.php b/database/migrations/2022_07_20_015804_add_column_to_settings_table.php new file mode 100644 index 0000000..f94fe56 --- /dev/null +++ b/database/migrations/2022_07_20_015804_add_column_to_settings_table.php @@ -0,0 +1,22 @@ +boolean('save_yabs_as_txt')->default(false)->after('show_server_value_yabs'); + }); + } + + public function down() + { + Schema::table('settings', function (Blueprint $table) { + $table->dropColumn('save_yabs_as_txt'); + }); + } +}; diff --git a/resources/views/settings/index.blade.php b/resources/views/settings/index.blade.php index b1ac953..2a7c9ab 100644 --- a/resources/views/settings/index.blade.php +++ b/resources/views/settings/index.blade.php @@ -107,6 +107,22 @@
+
+
+
+
Save YABs input to txt
+ +
+
+

Only if Show servers to public is YES do these apply:

From b1a135b41b08d0e992bf6bfa0696608c70d8aacb Mon Sep 17 00:00:00 2001 From: cp6 Date: Wed, 20 Jul 2022 13:08:52 +1000 Subject: [PATCH 07/14] Updated YABs show for new values Updated YABs show for new values (uptime, distro, swap) --- resources/views/yabs/show.blade.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/resources/views/yabs/show.blade.php b/resources/views/yabs/show.blade.php index ba1065a..7ed410a 100644 --- a/resources/views/yabs/show.blade.php +++ b/resources/views/yabs/show.blade.php @@ -17,6 +17,14 @@ Server {{ $yab[0]->server->hostname }} + + Uptime + {{ $yab[0]->uptime }} + + + Distro + {{ $yab[0]->distro }} + CPU {{ $yab[0]->cpu_cores }} @ {{$yab[0]->cpu_freq}} Mhz @@ -29,6 +37,10 @@ Ram {{ $yab[0]->ram }} {{$yab[0]->ram_type}} + + Swap + {{ $yab[0]->swap }} {{$yab[0]->swap_type}} + Disk {{ $yab[0]->disk }} {{$yab[0]->disk_type}} From 3d87c645dc9831c12a1ccaef2e98447a9e20724e Mon Sep 17 00:00:00 2001 From: cp6 Date: Wed, 20 Jul 2022 13:12:46 +1000 Subject: [PATCH 08/14] Updated style max container width Updated style max container width from 1320px to 1420px --- public/css/bootstrap-dark.min.css | Bin 163134 -> 163134 bytes public/css/bootstrap.min.css | Bin 163873 -> 163873 bytes 2 files changed, 0 insertions(+), 0 deletions(-) diff --git a/public/css/bootstrap-dark.min.css b/public/css/bootstrap-dark.min.css index 2a68b730c4d16e75c0be2ffec84a3086a0972add..87bc38b16acb4817a00bf1d41fd045dab7e5b335 100644 GIT binary patch delta 38 ucmdn@i*w&E&JCf8+$Kf_1r@cmdPVu=lM|gqn@bhjOBETnmnt%yj0ONQ#tx_e delta 38 ucmdn@i*w&E&JCf8+{Q)*1r@cmdPVu=lM|gqn@bhjOBETnmnt%yj0ONQst%_B diff --git a/public/css/bootstrap.min.css b/public/css/bootstrap.min.css index 3a41517105cf6bd1580fadbf6a56d6bb06e0a50b..c49c20aa3e3e68128d9b85d7cae347b56c14e559 100644 GIT binary patch delta 24 fcmZ43z_qY}YeTLAqe*j~LVKP9 Date: Wed, 20 Jul 2022 14:35:12 +1000 Subject: [PATCH 09/14] Updated Misc class to use relationships + cache Updated Misc class to use relationships + cache --- app/Http/Controllers/MiscController.php | 37 +++++++++---------------- app/Models/Misc.php | 22 +++++++++++++++ resources/views/misc/edit.blade.php | 20 ++++++------- resources/views/misc/index.blade.php | 14 +++++----- resources/views/misc/show.blade.php | 32 ++++++++++----------- 5 files changed, 68 insertions(+), 57 deletions(-) diff --git a/app/Http/Controllers/MiscController.php b/app/Http/Controllers/MiscController.php index c5fc361..271e9d7 100644 --- a/app/Http/Controllers/MiscController.php +++ b/app/Http/Controllers/MiscController.php @@ -14,10 +14,7 @@ class MiscController extends Controller { public function index() { - $misc = DB::table('misc_services as d') - ->join('pricings as pr', 'd.id', '=', 'pr.service_id') - ->get(['d.*', 'pr.*']); - + $misc = Misc::allMisc(); return view('misc.index', compact(['misc'])); } @@ -28,12 +25,8 @@ class MiscController extends Controller public function show(Misc $misc) { - $service_extras = DB::table('misc_services as m') - ->join('pricings as p', 'm.id', '=', 'p.service_id') - ->where('m.id', '=', $misc->id) - ->get(['m.*', 'p.*']); - - return view('misc.show', compact(['misc', 'service_extras'])); + $misc_data = Misc::misc($misc->id)[0]; + return view('misc.show', compact(['misc_data'])); } public function store(Request $request) @@ -45,20 +38,19 @@ class MiscController extends Controller 'next_due_date' => 'required|date' ]); - $ms_id = Str::random(8); + $misc_id = Str::random(8); $pricing = new Pricing(); - $as_usd = $pricing->convertToUSD($request->price, $request->currency); - - $pricing->insertPricing(5, $ms_id, $request->currency, $request->price, $request->payment_term, $as_usd, $request->next_due_date); + $pricing->insertPricing(5, $misc_id, $request->currency, $request->price, $request->payment_term, $as_usd, $request->next_due_date); Misc::create([ - 'id' => $ms_id, + 'id' => $misc_id, 'name' => $request->name, 'owned_since' => $request->owned_since ]); + Cache::forget("all_misc"); Home::homePageCacheForget(); return redirect()->route('misc.index') @@ -67,12 +59,8 @@ class MiscController extends Controller public function edit(Misc $misc) { - $misc = DB::table('misc_services as s') - ->join('pricings as p', 's.id', '=', 'p.service_id') - ->where('s.id', '=', $misc->id) - ->get(['s.*', 'p.*']); - - return view('misc.edit', compact('misc')); + $misc_data = Misc::misc($misc->id)[0]; + return view('misc.edit', compact('misc_data')); } public function update(Request $request, Misc $misc) @@ -91,11 +79,11 @@ class MiscController extends Controller ]); $pricing = new Pricing(); - $as_usd = $pricing->convertToUSD($request->price, $request->currency); - $pricing->updatePricing($misc->id, $request->currency, $request->price, $request->payment_term, $as_usd, $request->next_due_date); + Cache::forget("all_misc"); + Cache::forget("misc.{$misc->id}"); Home::homePageCacheForget(); return redirect()->route('misc.index') @@ -105,12 +93,13 @@ class MiscController extends Controller public function destroy(Misc $misc) { $items = Misc::find($misc->id); - $items->delete(); $p = new Pricing(); $p->deletePricing($misc->id); + Cache::forget("all_misc"); + Cache::forget("misc.{$misc->id}"); Home::homePageCacheForget(); return redirect()->route('misc.index') diff --git a/app/Models/Misc.php b/app/Models/Misc.php index cba204b..21115b0 100644 --- a/app/Models/Misc.php +++ b/app/Models/Misc.php @@ -4,6 +4,7 @@ namespace App\Models; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; +use Illuminate\Support\Facades\Cache; class Misc extends Model { @@ -14,4 +15,25 @@ class Misc extends Model protected $table = 'misc_services'; protected $fillable = ['id', 'name', 'owned_since']; + + public static function allMisc() + {//All misc and relationships (no using joins) + return Cache::remember("all_misc", now()->addMonth(1), function () { + return Misc::with(['price'])->get(); + }); + } + + public static function misc(string $misc_id) + {//Single misc and relationships (no using joins) + return Cache::remember("misc.$misc_id", now()->addMonth(1), function () use ($misc_id) { + return Misc::where('id', $misc_id) + ->with(['price'])->get(); + }); + } + + public function price() + { + return $this->hasOne(Pricing::class, 'service_id', 'id'); + } + } diff --git a/resources/views/misc/edit.blade.php b/resources/views/misc/edit.blade.php index b62c2c5..c05db6f 100644 --- a/resources/views/misc/edit.blade.php +++ b/resources/views/misc/edit.blade.php @@ -1,7 +1,7 @@ -@section('title') {{$misc[0]->name}} {{'edit'}} @endsection +@section('title') {{$misc_data->name}} {{'edit'}} @endsection - Edit {{ $misc[0]->name }} + Edit {{ $misc_data->name }}
@@ -11,7 +11,7 @@ Go back -
+ @csrf @method('PUT')
@@ -20,7 +20,7 @@
Name
+ name="name" required maxlength="255" value="{{$misc_data->name}}"> @error('name') {{ $message }} @enderror
@@ -30,17 +30,17 @@ Price price 0.01 - {{ $misc[0]->price }} + {{ $misc_data->price->price }}
- {{$misc[0]->term}} + {{$misc_data->price->term}}
- {{$misc[0]->currency}} + {{$misc_data->price->currency}}
@@ -49,20 +49,20 @@ Owned since owned_since - {{$misc[0]->owned_since }} + {{$misc_data->owned_since }}
Next due date next_due_date - {{$misc[0]->next_due_date}} + {{$misc_data->price->next_due_date}}
active === 1) ? 'checked' : '' }}> + value="1" {{ ($misc_data->active === 1) ? 'checked' : '' }}> diff --git a/resources/views/misc/index.blade.php b/resources/views/misc/index.blade.php index 74ac459..cd574b3 100644 --- a/resources/views/misc/index.blade.php +++ b/resources/views/misc/index.blade.php @@ -36,23 +36,23 @@ {{ date_format(new DateTime($m->owned_since), 'jS F Y') }} @endif - {{ now()->diffInDays($m->next_due_date) }} + {{ now()->diffInDays($m->price->next_due_date) }} days - {{$m->price}} {{$m->currency}} - {{\App\Process::paymentTermIntToString($m->term)}} + {{$m->price->price}} {{$m->price->currency}} + {{\App\Process::paymentTermIntToString($m->price->term)}} - - + - @csrf @method('DELETE') + id="btn-{{$m->name}}" title="{{$m->id}}"> diff --git a/resources/views/misc/show.blade.php b/resources/views/misc/show.blade.php index 9ba0200..8bb5e4c 100644 --- a/resources/views/misc/show.blade.php +++ b/resources/views/misc/show.blade.php @@ -1,4 +1,4 @@ -@section('title') {{ $service_extras[0]->name }} {{'service'}} @endsection +@section('title') {{ $misc_data->name }} {{'service'}} @endsection {{ __('Misc details') }} @@ -7,11 +7,11 @@
-

{{ $service_extras[0]->name}}

+

{{ $misc_data->name}}

-
{{ $service_extras[0]->service_id }}
- @if($service_extras[0]->active !== 1) +
{{ $misc_data->id }}
+ @if($misc_data->active !== 1)
not active
@endif
@@ -23,41 +23,41 @@ Service - {{ $service_extras[0]->name }} + {{ $misc_data->name }} Price - {{ $service_extras[0]->price }} {{ $service_extras[0]->currency }} - {{\App\Process::paymentTermIntToString($service_extras[0]->term)}} + {{ $misc_data->price->price }} {{ $misc_data->price->currency }} + {{\App\Process::paymentTermIntToString($misc_data->price->term)}} Owned since - @if(!is_null($service_extras[0]->owned_since)) - {{ date_format(new DateTime($service_extras[0]->owned_since), 'jS F Y') }} + @if(!is_null($misc_data->owned_since)) + {{ date_format(new DateTime($misc_data->owned_since), 'jS F Y') }} @endif Next due date - {{Carbon\Carbon::parse($service_extras[0]->next_due_date)->diffForHumans()}} - ({{Carbon\Carbon::parse($service_extras[0]->next_due_date)->format('d/m/Y')}}) + {{Carbon\Carbon::parse($misc_data->price->next_due_date)->diffForHumans()}} + ({{Carbon\Carbon::parse($misc_data->price->next_due_date)->format('d/m/Y')}}) Inserted - @if(!is_null($service_extras[0]->created_at)) - {{ date_format(new DateTime($service_extras[0]->created_at), 'jS M y g:i a') }} + @if(!is_null($misc_data->created_at)) + {{ date_format(new DateTime($misc_data->created_at), 'jS M y g:i a') }} @endif Updated - @if(!is_null($service_extras[0]->updated_at)) - {{ date_format(new DateTime($service_extras[0]->updated_at), 'jS M y g:i a') }} + @if(!is_null($misc_data->updated_at)) + {{ date_format(new DateTime($misc_data->updated_at), 'jS M y g:i a') }} @endif @@ -70,7 +70,7 @@ class="btn btn-success btn-sm mx-2"> Go back - Edit From c9108efd63575f6712542cc1f7c96836e4bfa3d7 Mon Sep 17 00:00:00 2001 From: cp6 Date: Wed, 20 Jul 2022 14:35:37 +1000 Subject: [PATCH 10/14] Updated SeedBoxes class to use relationships + cache Updated SeedBoxes class to use relationships + cache --- app/Http/Controllers/SeedBoxesController.php | 29 ++-- app/Models/SeedBoxes.php | 49 +++--- resources/views/seedboxes/edit.blade.php | 68 ++++---- resources/views/seedboxes/index.blade.php | 16 +- resources/views/seedboxes/show.blade.php | 80 +++++----- resources/views/servers/index-cards.blade.php | 149 ++++++++++++++++++ 6 files changed, 265 insertions(+), 126 deletions(-) create mode 100644 resources/views/servers/index-cards.blade.php diff --git a/app/Http/Controllers/SeedBoxesController.php b/app/Http/Controllers/SeedBoxesController.php index ed5bfe0..5a4ad2d 100644 --- a/app/Http/Controllers/SeedBoxesController.php +++ b/app/Http/Controllers/SeedBoxesController.php @@ -17,8 +17,7 @@ class SeedBoxesController extends Controller { public function index() { - $seedboxes = SeedBoxes::seedBoxesDataIndexPage(); - + $seedboxes = SeedBoxes::allSeedboxes(); return view('seedboxes.index', compact(['seedboxes'])); } @@ -48,13 +47,10 @@ class SeedBoxesController extends Controller $seedbox_id = Str::random(8); $pricing = new Pricing(); - $as_usd = $pricing->convertToUSD($request->price, $request->currency); - $pricing->insertPricing(6, $seedbox_id, $request->currency, $request->price, $request->payment_term, $as_usd, $request->next_due_date); Labels::deleteLabelsAssignedTo($seedbox_id); - Labels::insertLabelsAssigned([$request->label1, $request->label2, $request->label3, $request->label4], $seedbox_id); SeedBoxes::create([ @@ -73,6 +69,7 @@ class SeedBoxesController extends Controller 'was_promo' => $request->was_promo ]); + Cache::forget("all_seedboxes"); Home::homePageCacheForget(); return redirect()->route('seedboxes.index') @@ -82,20 +79,14 @@ class SeedBoxesController extends Controller public function show(SeedBoxes $seedbox) { - $seedbox_extras = SeedBoxes::seedBoxDataShowPage($seedbox->id); - - $labels = Labels::labelsForService($seedbox->id); - - return view('seedboxes.show', compact(['seedbox', 'seedbox_extras', 'labels'])); + $seedbox_data = SeedBoxes::seedbox($seedbox->id)[0]; + return view('seedboxes.show', compact(['seedbox_data'])); } public function edit(SeedBoxes $seedbox) { - $seedbox = SeedBoxes::seedBoxEditDataPage($seedbox->id); - - $labels = Labels::labelsForService($seedbox[0]->id); - - return view('seedboxes.edit', compact(['seedbox', 'labels'])); + $seedbox_data = SeedBoxes::seedbox($seedbox->id)[0]; + return view('seedboxes.edit', compact(['seedbox_data'])); } public function update(Request $request, SeedBoxes $seedbox) @@ -134,17 +125,15 @@ class SeedBoxesController extends Controller ]); $pricing = new Pricing(); - $as_usd = $pricing->convertToUSD($request->price, $request->currency); - $pricing->updatePricing($seedbox->id, $request->currency, $request->price, $request->payment_term, $as_usd, $request->next_due_date); Labels::deleteLabelsAssignedTo($seedbox->id); - Labels::insertLabelsAssigned([$request->label1, $request->label2, $request->label3, $request->label4], $seedbox->id); + Cache::forget("all_seedboxes"); + Cache::forget("seedbox.{$seedbox->id}"); Cache::forget("labels_for_service.{$seedbox->id}"); - Home::homePageCacheForget(); return redirect()->route('seedboxes.index') @@ -162,6 +151,8 @@ class SeedBoxesController extends Controller Labels::deleteLabelsAssignedTo($seedbox_id); + Cache::forget("all_seedboxes"); + Cache::forget("seedbox.{$seedbox->id}"); Home::homePageCacheForget(); return redirect()->route('seedboxes.index') diff --git a/app/Models/SeedBoxes.php b/app/Models/SeedBoxes.php index 4582881..3b82126 100644 --- a/app/Models/SeedBoxes.php +++ b/app/Models/SeedBoxes.php @@ -17,34 +17,39 @@ class SeedBoxes extends Model protected $fillable = ['id', 'active', 'title', 'hostname', 'seed_box_type', 'provider_id', 'location_id', 'bandwidth', 'port_speed', 'disk', 'disk_type', 'disk_as_gb', 'was_promo', 'owned_since']; - public static function seedBoxesDataIndexPage() - { - return DB::table('seedboxes as s') - ->join('providers as p', 's.provider_id', '=', 'p.id') - ->join('locations as l', 's.location_id', '=', 'l.id') - ->join('pricings as pr', 's.id', '=', 'pr.service_id') - ->get(['s.*', 'p.name as provider_name', 'pr.*', 'l.name as location']); + public static function allSeedboxes() + {//All seedboxes and relationships (no using joins) + return Cache::remember("all_seedboxes", now()->addMonth(1), function () { + return SeedBoxes::with(['location', 'provider', 'price', 'labels.label'])->get(); + }); } - public static function seedBoxDataShowPage(string $seed_box_id) - { - return DB::table('seedboxes 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') - ->where('s.id', '=', $seed_box_id) - ->get(['s.*', 'p.name as provider_name', 'l.name as location', 'pr.*']); + public static function seedbox(string $seedbox_id) + {//Single seedbox and relationships (no using joins) + return Cache::remember("seedbox.$seedbox_id", now()->addMonth(1), function () use ($seedbox_id) { + return SeedBoxes::where('id', $seedbox_id) + ->with(['location', 'provider', 'price', 'labels.label'])->get(); + }); } - public static function seedBoxEditDataPage(string $seed_box_id) + public function location() { - return DB::table('seedboxes 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') - ->where('s.id', '=', $seed_box_id) - ->get(['s.*', 'p.name as provider_name', 'l.name as location', 'pr.*']); + return $this->hasOne(Locations::class, 'id', 'location_id'); } + public function provider() + { + return $this->hasOne(Providers::class, 'id', 'provider_id'); + } + + public function price() + { + return $this->hasOne(Pricing::class, 'service_id', 'id'); + } + + public function labels() + { + return $this->hasMany(LabelsAssigned::class, 'service_id', 'id'); + } } diff --git a/resources/views/seedboxes/edit.blade.php b/resources/views/seedboxes/edit.blade.php index e846120..737c7bd 100644 --- a/resources/views/seedboxes/edit.blade.php +++ b/resources/views/seedboxes/edit.blade.php @@ -1,7 +1,7 @@ -@section('title') {{$seedbox[0]->title}} {{'edit'}} @endsection +@section('title') {{$seedbox_data->title}} {{'edit'}} @endsection - Edit {{ $seedbox[0]->title }} + Edit {{ $seedbox_data->title }}
@@ -11,7 +11,7 @@ Back to seed boxes -
+ @csrf @method('PUT')
@@ -20,7 +20,7 @@
Title
+ name="title" value="{{$seedbox_data->title}}"> @error('title') {{ $message }} @enderror
@@ -30,44 +30,44 @@
Hostname
+ name="hostname" value="{{$seedbox_data->hostname}}">
- +
Type
@@ -77,14 +77,14 @@
- {{$seedbox[0]->provider_id}} + {{$seedbox_data->provider->id}}
Price price - {{$seedbox[0]->price}} + {{$seedbox_data->price->price}} 9999 0.01 @@ -92,40 +92,40 @@
- {{$seedbox[0]->term}} + {{$seedbox_data->price->term}}
- {{$seedbox[0]->currency}} + {{$seedbox_data->price->currency}}
- {{$seedbox[0]->location_id}} + {{$seedbox_data->location_id}}
Promo price was_promo - {{ $seedbox[0]->was_promo }} + {{ $seedbox_data->was_promo }}
Owned since owned_since - {{$seedbox[0]->owned_since }} + {{$seedbox_data->owned_since }}
Next due date next_due_date - {{$seedbox[0]->next_due_date }} + {{$seedbox_data->price->next_due_date }}
@@ -137,7 +137,7 @@ 1 999999 1 - {{$seedbox[0]->disk_as_gb}} + {{$seedbox_data->disk_as_gb}}
@@ -147,7 +147,7 @@ 1 999999 1 - {{$seedbox[0]->bandwidth}} + {{$seedbox_data->bandwidth}}
@@ -157,7 +157,7 @@ 1 999999 1 - {{$seedbox[0]->port_speed}} + {{$seedbox_data->port_speed}}
@@ -166,8 +166,8 @@ label label1 - @if(isset($labels[0]->id)) - {{$labels[0]->id}} + @if(isset($seedbox_data->labels[0]->label->id)) + {{$seedbox_data->labels[0]->label->id}} @endif
@@ -175,8 +175,8 @@ label label2 - @if(isset($labels[1]->id)) - {{$labels[1]->id}} + @if(isset($seedbox_data->labels[1]->label->id)) + {{$seedbox_data->labels[1]->label->id}} @endif
@@ -184,8 +184,8 @@ label label3 - @if(isset($labels[2]->id)) - {{$labels[2]->id}} + @if(isset($seedbox_data->labels[2]->label->id)) + {{$seedbox_data->labels[2]->label->id}} @endif
@@ -193,15 +193,15 @@ label label4 - @if(isset($labels[3]->id)) - {{$labels[3]->id}} + @if(isset($seedbox_data->labels[3]->label->id)) + {{$seedbox_data->labels[3]->label->id}} @endif
active === 1) ? 'checked' : '' }}> + value="1" {{ ($seedbox_data->active === 1) ? 'checked' : '' }}> diff --git a/resources/views/seedboxes/index.blade.php b/resources/views/seedboxes/index.blade.php index 4e07d1b..aa1afd5 100644 --- a/resources/views/seedboxes/index.blade.php +++ b/resources/views/seedboxes/index.blade.php @@ -43,8 +43,8 @@ {{ $row->title }} {{ $row->seed_box_type }} - {{ $row->location }} - {{ $row->provider_name }} + {{ $row->location->name }} + {{ $row->provider->name }} @if($row->disk_as_gb >= 1000) {{ number_format($row->disk_as_gb / 1000,1) }} TB @@ -66,22 +66,22 @@ {{ $row->port_speed }} Mbps @endif - {{ $row->price }} {{$row->currency}} {{\App\Process::paymentTermIntToString($row->term)}} - {{Carbon\Carbon::parse($row->next_due_date)->diffForHumans()}} + {{ $row->price->price }} {{$row->price->currency}} {{\App\Process::paymentTermIntToString($row->price->term)}} + {{Carbon\Carbon::parse($row->price->next_due_date)->diffForHumans()}} {{ $row->owned_since }} - + @csrf - - + id="btn-{{$row->title}}" title="{{$row->id}}"> diff --git a/resources/views/seedboxes/show.blade.php b/resources/views/seedboxes/show.blade.php index b52f480..579a95d 100644 --- a/resources/views/seedboxes/show.blade.php +++ b/resources/views/seedboxes/show.blade.php @@ -1,4 +1,4 @@ -@section('title') {{$seedbox->title}} {{'Seed box'}} @endsection +@section('title') {{$seedbox_data->title}} {{'Seed box'}} @endsection {{ __('Seed box details') }} @@ -7,18 +7,14 @@
-

{{ $seedbox->title }}

- @foreach($labels as $label) - @if($loop->last) - {{$label->label}} - @else - {{$label->label}}, - @endif - @endforeach +

{{ $seedbox_data->title }}

+ @foreach($seedbox_data->labels as $label) + {{$label->label->label}} + @endforeach
-
{{ $seedbox->id }}
- @if($seedbox->active !== 1) +
{{ $seedbox_data->id }}
+ @if($seedbox_data->active !== 1)
not active
@endif
@@ -30,57 +26,57 @@ Type - {{ $seedbox->seed_box_type }} + {{ $seedbox_data->seed_box_type }} Hostname - {{ $seedbox_extras[0]->hostname }} + {{ $seedbox_data->hostname }} Location - {{ $seedbox_extras[0]->location }} + {{ $seedbox_data->location->name }} Provider - {{ $seedbox_extras[0]->provider_name }} + {{ $seedbox_data->provider->name }} Price - {{ $seedbox_extras[0]->price }} {{ $seedbox_extras[0]->currency }} - {{\App\Process::paymentTermIntToString($seedbox_extras[0]->term)}} + {{ $seedbox_data->price->price }} {{ $seedbox_data->price->currency }} + {{\App\Process::paymentTermIntToString($seedbox_data->price->term)}} Was promo - {{ ($seedbox_extras[0]->was_promo === 1) ? 'Yes' : 'No' }} + {{ ($seedbox_data->was_promo === 1) ? 'Yes' : 'No' }} Owned since - @if(!is_null($seedbox->owned_since)) - {{ date_format(new DateTime($seedbox->owned_since), 'jS F Y') }} + @if(!is_null($seedbox_data->owned_since)) + {{ date_format(new DateTime($seedbox_data->owned_since), 'jS F Y') }} @endif Next due date - {{Carbon\Carbon::parse($seedbox_extras[0]->next_due_date)->diffForHumans()}} - ({{Carbon\Carbon::parse($seedbox_extras[0]->next_due_date)->format('d/m/Y')}}) + {{Carbon\Carbon::parse($seedbox_data->price->next_due_date)->diffForHumans()}} + ({{Carbon\Carbon::parse($seedbox_data->price->next_due_date)->format('d/m/Y')}}) Inserted - @if(!is_null($seedbox->created_at)) - {{ date_format(new DateTime($seedbox->created_at), 'jS M y g:i a') }} + @if(!is_null($seedbox_data->created_at)) + {{ date_format(new DateTime($seedbox_data->created_at), 'jS M y g:i a') }} @endif Updated - @if(!is_null($seedbox->updated_at)) - {{ date_format(new DateTime($seedbox->updated_at), 'jS M y g:i a') }} + @if(!is_null($seedbox_data->updated_at)) + {{ date_format(new DateTime($seedbox_data->updated_at), 'jS M y g:i a') }} @endif @@ -94,30 +90,30 @@ Disk - @if($seedbox->disk_as_gb >= 1000) - {{ number_format($seedbox->disk_as_gb / 1000,1) }} TB + @if($seedbox_data->disk_as_gb >= 1000) + {{ number_format($seedbox_data->disk_as_gb / 1000,1) }} TB @else - {{ $seedbox->disk_as_gb }} GB + {{ $seedbox_data->disk_as_gb }} GB @endif Bandwidth - @if($seedbox->bandwidth >= 1000) - {{ number_format($seedbox->bandwidth / 1000,1) }} TB + @if($seedbox_data->bandwidth >= 1000) + {{ number_format($seedbox_data->bandwidth / 1000,1) }} TB @else - {{ $seedbox->bandwidth }} GB + {{ $seedbox_data->bandwidth }} GB @endif Port speed - @if($seedbox->port_speed >= 1000) - {{ number_format($seedbox->port_speed / 1000,1) }} Gbps + @if($seedbox_data->port_speed >= 1000) + {{ number_format($seedbox_data->port_speed / 1000,1) }} Gbps @else - {{ $seedbox->port_speed }} Mbps + {{ $seedbox_data->port_speed }} Mbps @endif @@ -126,14 +122,12 @@
- - Go back - - - Edit - + + {{ route('seedboxes.index') }} + + + {{ route('seedboxes.edit', $seedbox_data->id) }} + @if(Session::has('timer_version_footer') && Session::get('timer_version_footer') === 1)

diff --git a/resources/views/servers/index-cards.blade.php b/resources/views/servers/index-cards.blade.php new file mode 100644 index 0000000..7f5af80 --- /dev/null +++ b/resources/views/servers/index-cards.blade.php @@ -0,0 +1,149 @@ +@section('title') + {{'Servers'}} +@endsection +@section('style') + +@endsection +@section('scripts') + + +@endsection + + + {{ __('Servers') }} + +

+ + +
+
+
+ @if(!empty($servers)) + @foreach($servers as $server) +
+
+
+
+
+
{{ $server->hostname }}
+
+
+ + + +
+
+
+
+
{{ $server->location->name }}
+
+
+
{{ $server->price->currency }} {{ $server->price->price }}
+
+
+
+
+

{{ $server->provider->name }}

+
+
+

{{ $server->os->name }}

+
+
+
+
+ {{$server->cpu}} + +
+
+ {{$server->ram}} {{$server->ram_type}} + +
+
+
+
+ {{$server->disk}} {{$server->disk_type}} + +
+
+ @if(isset($server->yabs[0]->cpu_cores)) + YABs + @else + YABs + @endif +
+
+
+
+
+ @endforeach + @endif +
+
+
+ +
+ @if(Session::has('timer_version_footer') && Session::get('timer_version_footer') === 1) +

Built on Laravel + v{{ Illuminate\Foundation\Application::VERSION }} (PHP v{{ PHP_VERSION }})

+ @endif +
+ + + From bb07f86deb14843cefc2b5669c2df27fdc739a31 Mon Sep 17 00:00:00 2001 From: cp6 Date: Wed, 20 Jul 2022 14:36:19 +1000 Subject: [PATCH 11/14] Updated Labels class Removed unused function Added assigned() hasMany --- app/Models/Labels.php | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/app/Models/Labels.php b/app/Models/Labels.php index 50f1840..02fd417 100644 --- a/app/Models/Labels.php +++ b/app/Models/Labels.php @@ -43,14 +43,9 @@ class Labels extends Model }); } - public static function labelsForService(string $service_id) + public function assigned() { - return Cache::remember("labels_for_service.$service_id", now()->addMinute(5), function () use ($service_id) { - return DB::table('labels_assigned as l') - ->join('labels', 'l.label_id', '=', 'labels.id') - ->where('l.service_id', '=', $service_id) - ->get(['labels.id', 'labels.label']); - }); + return $this->hasMany(LabelsAssigned::class, 'label_id', 'id'); } } From 3340d296f94ecf88cd56a5bbe60b9c8b08bb6c5c Mon Sep 17 00:00:00 2001 From: cp6 Date: Wed, 20 Jul 2022 14:37:37 +1000 Subject: [PATCH 12/14] Updated ApiController to use new Class fetching (Relationships) Updated ApiController to use new Class fetching (Relationships) --- app/Http/Controllers/ApiController.php | 102 +++++-------------------- 1 file changed, 20 insertions(+), 82 deletions(-) diff --git a/app/Http/Controllers/ApiController.php b/app/Http/Controllers/ApiController.php index 19015fa..c67eb7b 100644 --- a/app/Http/Controllers/ApiController.php +++ b/app/Http/Controllers/ApiController.php @@ -2,12 +2,16 @@ namespace App\Http\Controllers; +use App\Models\Domains; use App\Models\IPs; use App\Models\Labels; +use App\Models\Misc; use App\Models\NetworkSpeed; use App\Models\OS; use App\Models\Pricing; use App\Models\Providers; +use App\Models\Reseller; +use App\Models\SeedBoxes; use App\Models\Server; use App\Models\Shared; use DataTables; @@ -21,53 +25,13 @@ class ApiController extends Controller { protected function getAllServers() { - $servers = DB::table('servers as s') - ->Join('pricings as p', 's.id', '=', 'p.service_id') - ->join('providers as pr', 's.provider_id', '=', 'pr.id') - ->join('locations as l', 's.location_id', '=', 'l.id') - ->join('os as o', 's.os_id', '=', 'o.id') - ->get(['s.*', 'p.id as price_id', 'p.currency', 'p.price', 'p.term', 'p.as_usd', 'p.usd_per_month', 'p.next_due_date', 'pr.name as provider', 'l.name as location', 'o.name as os'])->toJson(JSON_PRETTY_PRINT); - + $servers = Server::allServers()->toJson(JSON_PRETTY_PRINT); return response($servers, 200); } protected function getServer($id) { - $server = DB::table('servers as s') - ->Join('pricings as p', 's.id', '=', 'p.service_id') - ->join('providers as pr', 's.provider_id', '=', 'pr.id') - ->join('locations as l', 's.location_id', '=', 'l.id') - ->join('os as o', 's.os_id', '=', 'o.id') - ->where('s.id', '=', $id) - ->get(['s.*', 'p.id as price_id', 'p.currency', 'p.price', 'p.term', 'p.as_usd', 'p.usd_per_month', 'p.next_due_date', 'pr.name as provider', 'l.name as location', 'o.name as os']); - - $yabs = DB::table('yabs') - ->where('yabs.server_id', '=', $id) - ->get(); - - $disk_speed = DB::table('disk_speed') - ->where('disk_speed.server_id', '=', $id) - ->get(); - - $network_speed = DB::table('network_speed') - ->where('network_speed.server_id', '=', $id) - ->get(); - - $labels = DB::table('labels_assigned as la') - ->Join('labels as l', 'la.label_id', '=', 'l.id') - ->where('la.service_id', '=', $id) - ->get(['l.*']); - - $ip_addresses = DB::table('ips as i') - ->where('i.service_id', '=', $id) - ->get(['i.*']); - - $server['ip_addresses'] = $ip_addresses; - $server['yabs'] = $yabs; - $server['disk_speed'] = $disk_speed; - $server['network_speed'] = $network_speed; - $server['labels'] = $labels; - + $server = Server::server($id)->toJson(JSON_PRETTY_PRINT); return response($server, 200); } @@ -79,7 +43,8 @@ class ApiController extends Controller protected function getPricing($id) { - $pricing = Pricing::where('id', $id)->get()->toJson(JSON_PRETTY_PRINT); + $pricing = Pricing::where('id', $id) + ->get()->toJson(JSON_PRETTY_PRINT); return response($pricing, 200); } @@ -91,8 +56,7 @@ class ApiController extends Controller protected function getNetworkSpeeds($id) { - $ns = DB::table('network_speed as n') - ->where('n.server_id', '=', $id) + $ns = NetworkSpeed::where('server_id', '=', $id) ->get()->toJson(JSON_PRETTY_PRINT); return response($ns, 200); } @@ -105,94 +69,68 @@ class ApiController extends Controller protected function getLabel($id) { - $label = DB::table('labels as l') - ->where('l.id', '=', $id) + $label = Labels::where('id', '=', $id) ->get()->toJson(JSON_PRETTY_PRINT); return response($label, 200); } protected function getAllShared() { - $shared = DB::table('shared_hosting as sh') - ->Join('pricings as p', 'sh.id', '=', 'p.service_id') - ->get(['sh.*', 'p.id as price_id', 'p.currency', 'p.price', 'p.term', 'p.as_usd', 'p.usd_per_month', 'p.next_due_date'])->toJson(JSON_PRETTY_PRINT); + $shared = Shared::allSharedHosting()->toJson(JSON_PRETTY_PRINT); return response($shared, 200); } protected function getShared($id) { - $shared = DB::table('shared_hosting as sh') - ->Join('pricings as p', 'sh.id', '=', 'p.service_id') - ->where('sh.id', '=', $id) - ->get(['sh.*', 'p.id as price_id', 'p.currency', 'p.price', 'p.term', 'p.as_usd', 'p.usd_per_month', 'p.next_due_date'])->toJson(JSON_PRETTY_PRINT); + $shared = Shared::sharedHosting($id)->toJson(JSON_PRETTY_PRINT); return response($shared, 200); } protected function getAllReseller() { - $reseller = DB::table('reseller_hosting as rh') - ->Join('pricings as p', 'rh.id', '=', 'p.service_id') - ->get(['rh.*', 'p.id as price_id', 'p.currency', 'p.price', 'p.term', 'p.as_usd', 'p.usd_per_month', 'p.next_due_date'])->toJson(JSON_PRETTY_PRINT); + $reseller = Reseller::allResellerHosting()->toJson(JSON_PRETTY_PRINT); return response($reseller, 200); } protected function getReseller($id) { - $reseller = DB::table('reseller_hosting as rh') - ->Join('pricings as p', 'rh.id', '=', 'p.service_id') - ->where('rh.id', '=', $id) - ->get(['rh.*', 'p.id as price_id', 'p.currency', 'p.price', 'p.term', 'p.as_usd', 'p.usd_per_month', 'p.next_due_date'])->toJson(JSON_PRETTY_PRINT); + $reseller = Reseller::resellerHosting($id)->toJson(JSON_PRETTY_PRINT); return response($reseller, 200); } protected function getAllSeedbox() { - $reseller = DB::table('seedboxes as sb') - ->Join('pricings as p', 'sb.id', '=', 'p.service_id') - ->get(['sb.*', 'p.id as price_id', 'p.currency', 'p.price', 'p.term', 'p.as_usd', 'p.usd_per_month', 'p.next_due_date'])->toJson(JSON_PRETTY_PRINT); + $reseller = SeedBoxes::allSeedboxes()->toJson(JSON_PRETTY_PRINT); return response($reseller, 200); } protected function getSeedbox($id) { - $reseller = DB::table('seedboxes as sb') - ->Join('pricings as p', 'sb.id', '=', 'p.service_id') - ->where('sb.id', '=', $id) - ->get(['sb.*', 'p.id as price_id', 'p.currency', 'p.price', 'p.term', 'p.as_usd', 'p.usd_per_month', 'p.next_due_date'])->toJson(JSON_PRETTY_PRINT); + $reseller = SeedBoxes::seedbox($id)->toJson(JSON_PRETTY_PRINT); return response($reseller, 200); } protected function getAllDomains() { - $domains = DB::table('domains as d') - ->Join('pricings as p', 'd.id', '=', 'p.service_id') - ->get(['d.*', 'p.id as price_id', 'p.currency', 'p.price', 'p.term', 'p.as_usd', 'p.usd_per_month', 'p.next_due_date'])->toJson(JSON_PRETTY_PRINT); + $domains = Domains::allDomains()->toJson(JSON_PRETTY_PRINT); return response($domains, 200); } protected function getDomains($id) { - $domain = DB::table('domains as d') - ->Join('pricings as p', 'd.id', '=', 'p.service_id') - ->where('d.id', '=', $id) - ->get(['d.*', 'p.id as price_id', 'p.currency', 'p.price', 'p.term', 'p.as_usd', 'p.usd_per_month', 'p.next_due_date'])->toJson(JSON_PRETTY_PRINT); + $domain = Domains::domain($id)->toJson(JSON_PRETTY_PRINT); return response($domain, 200); } protected function getAllMisc() { - $misc = DB::table('misc_services as m') - ->Join('pricings as p', 'm.id', '=', 'p.service_id') - ->get(['m.*', 'p.id as price_id', 'p.currency', 'p.price', 'p.term', 'p.as_usd', 'p.usd_per_month', 'p.next_due_date'])->toJson(JSON_PRETTY_PRINT); + $misc = Misc::allMisc()->toJson(JSON_PRETTY_PRINT); return response($misc, 200); } protected function getMisc($id) { - $misc = DB::table('misc_services as m') - ->Join('pricings as p', 'm.id', '=', 'p.service_id') - ->where('m.id', '=', $id) - ->get(['m.*', 'p.id as price_id', 'p.currency', 'p.price', 'p.term', 'p.as_usd', 'p.usd_per_month', 'p.next_due_date'])->toJson(JSON_PRETTY_PRINT); + $misc = Misc::misc($id)->toJson(JSON_PRETTY_PRINT); return response($misc, 200); } From e6943b46402a8492c8c3945367f9979ae5db028a Mon Sep 17 00:00:00 2001 From: cp6 Date: Wed, 20 Jul 2022 14:47:37 +1000 Subject: [PATCH 13/14] Updated readme for 2.1.3 Updated readme for 2.1.3 --- README.md | 144 +++++++++++++++++++++++++++++------------------------- 1 file changed, 78 insertions(+), 66 deletions(-) diff --git a/README.md b/README.md index 017167b..54a7abd 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,18 @@ # My idlers -A web app for displaying, organizing and storing information about servers (VPS), shared & reseller hosting, seed boxes, domains, +A web app for displaying, organizing and storing information about servers (VPS), shared & reseller hosting, seed boxes, +domains, DNS and misc services. Despite what the name infers this self hosted web app isn't just for storing idling server information. By using a [YABs](https://github.com/masonr/yet-another-bench-script) output you can get disk & network speed values along with GeekBench 5 scores to do easier comparing and sorting. -[![Generic badge](https://img.shields.io/badge/version-2.1.2-blue.svg)](https://shields.io/) [![Generic badge](https://img.shields.io/badge/Laravel-9.0-red.svg)](https://shields.io/) [![Generic badge](https://img.shields.io/badge/PHP-8.1-purple.svg)](https://shields.io/) [![Generic badge](https://img.shields.io/badge/Bootstrap-5.1-pink.svg)](https://shields.io/) +[![Generic badge](https://img.shields.io/badge/version-2.1.3-blue.svg)](https://shields.io/) [![Generic badge](https://img.shields.io/badge/Laravel-9.0-red.svg)](https://shields.io/) [![Generic badge](https://img.shields.io/badge/PHP-8.1-purple.svg)](https://shields.io/) [![Generic badge](https://img.shields.io/badge/Bootstrap-5.1-pink.svg)](https://shields.io/) -[Demo site](https://demo.myidlers.com/) +[Demo site](https://demo.myidlers.com/) **Note:** Create, Update and Delete are disabled on demo site. @@ -19,15 +20,26 @@ GeekBench 5 scores to do easier comparing and sorting. [Cloud Five Limited](https://cloud-v.net/) for providing the hosting for demo installation. -## 2.1.2 changes (19th July 2022): +## 2.1.3 changes (20th July 2022): -* Added YABs compare page -* Added caching for YABs -* Added LabelsAssigned model -* Updated Server model to use relationships -* Updated Shared model to use relationships -* Updated Shared model to use caching -* Updated Table model to have table name defined +#### Please run the following if updating from existing install: + +```shell +php artisan migrate +php artisan route:cache +php artisan cache:clear +``` + +* Added YABs to JSON output page +* Added uptime, distro and kernel to YABs inserting +* Added memory swap values to YABs inserting +* Added save YABs as txt file (setting) +* Added back and edit button component with icon +* Updated Reseller model to use relationships + caching +* Updated Misc model to use relationships + caching +* Updated SeedBoxes model to use relationships + caching +* Updated ApiController to use the new model relationship calling (& caching) +* Updated container large screen max width from 1320px to 1420px * Fixed server compare initial selection * Fixed switch in getIpForDomain() @@ -65,13 +77,15 @@ GeekBench 5 scores to do easier comparing and sorting. * Run `php artisan migrate:fresh --seed` to create tables and seed data * Run `php artisan serve` -## Update +## Updating -If you have at least version 2.0 installed: +If you already have at least version 2.0 installed: * Run `git clone https://github.com/cp6/my-idlers.git` * Run `composer install` * Run `php artisan migrate` +* Run `php artisan route:cache` +* Run `php artisan cache:clear` ## Run using Docker @@ -93,7 +107,6 @@ Run with a single click on [PikaPods.com](https://www.pikapods.com/) [![PikaPods](https://www.pikapods.com/static/run-button.svg)](https://www.pikapods.com/pods?run=my-idlers) - ## API endpoints For GET requests the header must have `Accept: application/json` and your API token (found at `/account`) @@ -168,35 +181,35 @@ Body content template ```json { -"active": 1, -"show_public": 0, -"hostname": "test.domain.com", -"ns1": "ns1", -"ns2": "ns2", -"server_type": 1, -"os_id": 2, -"provider_id": 10, -"location_id": 15, -"ssh_port": 22, -"bandwidth": 2000, -"ram": 2024, -"ram_type": "MB", -"ram_as_mb": 2024, -"disk": 30, -"disk_type": "GB", -"disk_as_gb": 30, -"cpu": 2, -"has_yabs": 0, -"was_promo": 1, -"ip1": "127.0.0.1", -"ip2": null, -"owned_since": "2022-01-01", -"currency": "USD", -"price": 4.00, -"payment_term": 1, -"as_usd": 4.00, -"usd_per_month": 4.00, -"next_due_date": "2022-02-01" + "active": 1, + "show_public": 0, + "hostname": "test.domain.com", + "ns1": "ns1", + "ns2": "ns2", + "server_type": 1, + "os_id": 2, + "provider_id": 10, + "location_id": 15, + "ssh_port": 22, + "bandwidth": 2000, + "ram": 2024, + "ram_type": "MB", + "ram_as_mb": 2024, + "disk": 30, + "disk_type": "GB", + "disk_as_gb": 30, + "cpu": 2, + "has_yabs": 0, + "was_promo": 1, + "ip1": "127.0.0.1", + "ip2": null, + "owned_since": "2022-01-01", + "currency": "USD", + "price": 4.00, + "payment_term": 1, + "as_usd": 4.00, + "usd_per_month": 4.00, + "next_due_date": "2022-02-01" } ``` @@ -210,27 +223,27 @@ Body content template ```json { -"active": 1, -"show_public": 0, -"hostname": "test.domain.com", -"ns1": "ns1", -"ns2": "ns2", -"server_type": 1, -"os_id": 2, -"provider_id": 10, -"location_id": 15, -"ssh_port": 22, -"bandwidth": 2000, -"ram": 2024, -"ram_type": "MB", -"ram_as_mb": 2024, -"disk": 30, -"disk_type": "GB", -"disk_as_gb": 30, -"cpu": 2, -"has_yabs": 0, -"was_promo": 1, -"owned_since": "2022-01-01" + "active": 1, + "show_public": 0, + "hostname": "test.domain.com", + "ns1": "ns1", + "ns2": "ns2", + "server_type": 1, + "os_id": 2, + "provider_id": 10, + "location_id": 15, + "ssh_port": 22, + "bandwidth": 2000, + "ram": 2024, + "ram_type": "MB", + "ram_as_mb": 2024, + "disk": 30, + "disk_type": "GB", + "disk_as_gb": 30, + "cpu": 2, + "has_yabs": 0, + "was_promo": 1, + "owned_since": "2022-01-01" } ``` @@ -244,7 +257,7 @@ Body content template { "price": 10.50, "currency": "USD", - "term" : 1 + "term": 1 } ``` @@ -254,7 +267,6 @@ Delete a server `/servers/ID` - ## Notes **Public viewable listings** From 01e2613d905d0905ac8853e65924027f55b5c0e1 Mon Sep 17 00:00:00 2001 From: cp6 Date: Wed, 20 Jul 2022 14:48:19 +1000 Subject: [PATCH 14/14] Updated readme Updated readme --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index 54a7abd..6b568a6 100644 --- a/README.md +++ b/README.md @@ -40,8 +40,6 @@ php artisan cache:clear * Updated SeedBoxes model to use relationships + caching * Updated ApiController to use the new model relationship calling (& caching) * Updated container large screen max width from 1320px to 1420px -* Fixed server compare initial selection -* Fixed switch in getIpForDomain() ## Requires