Merge pull request #55 from cp6/Development

Development 2.1.3
This commit is contained in:
corbpie 2022-07-20 14:55:51 +10:00 committed by GitHub
commit 82f3b62761
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
42 changed files with 883 additions and 656 deletions

146
README.md
View File

@ -1,17 +1,18 @@
# My idlers # 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. DNS and misc services.
Despite what the name infers this self hosted web app isn't just for storing idling server information. By using 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 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. 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/)
<img src="https://raw.githubusercontent.com/cp6/my-idlers/main/public/My%20Idlers%20logo.jpg" width="128" height="128" /> <img src="https://raw.githubusercontent.com/cp6/my-idlers/main/public/My%20Idlers%20logo.jpg" width="128" height="128" />
[Demo site](https://demo.myidlers.com/) [Demo site](https://demo.myidlers.com/)
**Note:** Create, Update and Delete are disabled on demo site. **Note:** Create, Update and Delete are disabled on demo site.
@ -19,17 +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. [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 #### Please run the following if updating from existing install:
* Added caching for YABs
* Added LabelsAssigned model ```shell
* Updated Server model to use relationships php artisan migrate
* Updated Shared model to use relationships php artisan route:cache
* Updated Shared model to use caching php artisan cache:clear
* Updated Table model to have table name defined ```
* Fixed server compare initial selection
* Fixed switch in getIpForDomain() * 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
## Requires ## Requires
@ -65,13 +75,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 migrate:fresh --seed` to create tables and seed data
* Run `php artisan serve` * 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 `git clone https://github.com/cp6/my-idlers.git`
* Run `composer install` * Run `composer install`
* Run `php artisan migrate` * Run `php artisan migrate`
* Run `php artisan route:cache`
* Run `php artisan cache:clear`
## Run using Docker ## Run using Docker
@ -93,7 +105,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) [![PikaPods](https://www.pikapods.com/static/run-button.svg)](https://www.pikapods.com/pods?run=my-idlers)
## API endpoints ## API endpoints
For GET requests the header must have `Accept: application/json` and your API token (found at `/account`) For GET requests the header must have `Accept: application/json` and your API token (found at `/account`)
@ -168,35 +179,35 @@ Body content template
```json ```json
{ {
"active": 1, "active": 1,
"show_public": 0, "show_public": 0,
"hostname": "test.domain.com", "hostname": "test.domain.com",
"ns1": "ns1", "ns1": "ns1",
"ns2": "ns2", "ns2": "ns2",
"server_type": 1, "server_type": 1,
"os_id": 2, "os_id": 2,
"provider_id": 10, "provider_id": 10,
"location_id": 15, "location_id": 15,
"ssh_port": 22, "ssh_port": 22,
"bandwidth": 2000, "bandwidth": 2000,
"ram": 2024, "ram": 2024,
"ram_type": "MB", "ram_type": "MB",
"ram_as_mb": 2024, "ram_as_mb": 2024,
"disk": 30, "disk": 30,
"disk_type": "GB", "disk_type": "GB",
"disk_as_gb": 30, "disk_as_gb": 30,
"cpu": 2, "cpu": 2,
"has_yabs": 0, "has_yabs": 0,
"was_promo": 1, "was_promo": 1,
"ip1": "127.0.0.1", "ip1": "127.0.0.1",
"ip2": null, "ip2": null,
"owned_since": "2022-01-01", "owned_since": "2022-01-01",
"currency": "USD", "currency": "USD",
"price": 4.00, "price": 4.00,
"payment_term": 1, "payment_term": 1,
"as_usd": 4.00, "as_usd": 4.00,
"usd_per_month": 4.00, "usd_per_month": 4.00,
"next_due_date": "2022-02-01" "next_due_date": "2022-02-01"
} }
``` ```
@ -210,27 +221,27 @@ Body content template
```json ```json
{ {
"active": 1, "active": 1,
"show_public": 0, "show_public": 0,
"hostname": "test.domain.com", "hostname": "test.domain.com",
"ns1": "ns1", "ns1": "ns1",
"ns2": "ns2", "ns2": "ns2",
"server_type": 1, "server_type": 1,
"os_id": 2, "os_id": 2,
"provider_id": 10, "provider_id": 10,
"location_id": 15, "location_id": 15,
"ssh_port": 22, "ssh_port": 22,
"bandwidth": 2000, "bandwidth": 2000,
"ram": 2024, "ram": 2024,
"ram_type": "MB", "ram_type": "MB",
"ram_as_mb": 2024, "ram_as_mb": 2024,
"disk": 30, "disk": 30,
"disk_type": "GB", "disk_type": "GB",
"disk_as_gb": 30, "disk_as_gb": 30,
"cpu": 2, "cpu": 2,
"has_yabs": 0, "has_yabs": 0,
"was_promo": 1, "was_promo": 1,
"owned_since": "2022-01-01" "owned_since": "2022-01-01"
} }
``` ```
@ -244,7 +255,7 @@ Body content template
{ {
"price": 10.50, "price": 10.50,
"currency": "USD", "currency": "USD",
"term" : 1 "term": 1
} }
``` ```
@ -254,7 +265,6 @@ Delete a server
`/servers/ID` `/servers/ID`
## Notes ## Notes
**Public viewable listings** **Public viewable listings**

View File

@ -2,12 +2,16 @@
namespace App\Http\Controllers; namespace App\Http\Controllers;
use App\Models\Domains;
use App\Models\IPs; use App\Models\IPs;
use App\Models\Labels; use App\Models\Labels;
use App\Models\Misc;
use App\Models\NetworkSpeed; use App\Models\NetworkSpeed;
use App\Models\OS; use App\Models\OS;
use App\Models\Pricing; use App\Models\Pricing;
use App\Models\Providers; use App\Models\Providers;
use App\Models\Reseller;
use App\Models\SeedBoxes;
use App\Models\Server; use App\Models\Server;
use App\Models\Shared; use App\Models\Shared;
use DataTables; use DataTables;
@ -21,53 +25,13 @@ class ApiController extends Controller
{ {
protected function getAllServers() protected function getAllServers()
{ {
$servers = DB::table('servers as s') $servers = Server::allServers()->toJson(JSON_PRETTY_PRINT);
->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);
return response($servers, 200); return response($servers, 200);
} }
protected function getServer($id) protected function getServer($id)
{ {
$server = DB::table('servers as s') $server = Server::server($id)->toJson(JSON_PRETTY_PRINT);
->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;
return response($server, 200); return response($server, 200);
} }
@ -79,7 +43,8 @@ class ApiController extends Controller
protected function getPricing($id) 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); return response($pricing, 200);
} }
@ -91,8 +56,7 @@ class ApiController extends Controller
protected function getNetworkSpeeds($id) protected function getNetworkSpeeds($id)
{ {
$ns = DB::table('network_speed as n') $ns = NetworkSpeed::where('server_id', '=', $id)
->where('n.server_id', '=', $id)
->get()->toJson(JSON_PRETTY_PRINT); ->get()->toJson(JSON_PRETTY_PRINT);
return response($ns, 200); return response($ns, 200);
} }
@ -105,94 +69,68 @@ class ApiController extends Controller
protected function getLabel($id) protected function getLabel($id)
{ {
$label = DB::table('labels as l') $label = Labels::where('id', '=', $id)
->where('l.id', '=', $id)
->get()->toJson(JSON_PRETTY_PRINT); ->get()->toJson(JSON_PRETTY_PRINT);
return response($label, 200); return response($label, 200);
} }
protected function getAllShared() protected function getAllShared()
{ {
$shared = DB::table('shared_hosting as sh') $shared = Shared::allSharedHosting()->toJson(JSON_PRETTY_PRINT);
->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);
return response($shared, 200); return response($shared, 200);
} }
protected function getShared($id) protected function getShared($id)
{ {
$shared = DB::table('shared_hosting as sh') $shared = Shared::sharedHosting($id)->toJson(JSON_PRETTY_PRINT);
->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);
return response($shared, 200); return response($shared, 200);
} }
protected function getAllReseller() protected function getAllReseller()
{ {
$reseller = DB::table('reseller_hosting as rh') $reseller = Reseller::allResellerHosting()->toJson(JSON_PRETTY_PRINT);
->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);
return response($reseller, 200); return response($reseller, 200);
} }
protected function getReseller($id) protected function getReseller($id)
{ {
$reseller = DB::table('reseller_hosting as rh') $reseller = Reseller::resellerHosting($id)->toJson(JSON_PRETTY_PRINT);
->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);
return response($reseller, 200); return response($reseller, 200);
} }
protected function getAllSeedbox() protected function getAllSeedbox()
{ {
$reseller = DB::table('seedboxes as sb') $reseller = SeedBoxes::allSeedboxes()->toJson(JSON_PRETTY_PRINT);
->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);
return response($reseller, 200); return response($reseller, 200);
} }
protected function getSeedbox($id) protected function getSeedbox($id)
{ {
$reseller = DB::table('seedboxes as sb') $reseller = SeedBoxes::seedbox($id)->toJson(JSON_PRETTY_PRINT);
->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);
return response($reseller, 200); return response($reseller, 200);
} }
protected function getAllDomains() protected function getAllDomains()
{ {
$domains = DB::table('domains as d') $domains = Domains::allDomains()->toJson(JSON_PRETTY_PRINT);
->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);
return response($domains, 200); return response($domains, 200);
} }
protected function getDomains($id) protected function getDomains($id)
{ {
$domain = DB::table('domains as d') $domain = Domains::domain($id)->toJson(JSON_PRETTY_PRINT);
->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);
return response($domain, 200); return response($domain, 200);
} }
protected function getAllMisc() protected function getAllMisc()
{ {
$misc = DB::table('misc_services as m') $misc = Misc::allMisc()->toJson(JSON_PRETTY_PRINT);
->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);
return response($misc, 200); return response($misc, 200);
} }
protected function getMisc($id) protected function getMisc($id)
{ {
$misc = DB::table('misc_services as m') $misc = Misc::misc($id)->toJson(JSON_PRETTY_PRINT);
->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);
return response($misc, 200); return response($misc, 200);
} }

View File

@ -14,20 +14,16 @@ use Illuminate\Support\Str;
class DomainsController extends Controller class DomainsController extends Controller
{ {
public function index() public function index()
{ {
$domains = Domains::domainsDataIndexPage(); $domains = Domains::allDomains();
return view('domains.index', compact(['domains'])); return view('domains.index', compact(['domains']));
} }
public function show(Domains $domain) public function show(Domains $domain)
{ {//Need to modern
$service_extras = Domains::domainsDataShowPage($domain->id); $domain_info = Domains::domain($domain->id)[0];
$labels = Labels::labelsForService($domain->id); return view('domains.show', compact(['domain_info']));
return view('domains.show', compact(['domain', 'service_extras', 'labels']));
} }
public function create() public function create()
@ -46,11 +42,8 @@ class DomainsController extends Controller
]); ]);
$domain_id = Str::random(8); $domain_id = Str::random(8);
$pricing = new Pricing(); $pricing = new Pricing();
$as_usd = $pricing->convertToUSD($request->price, $request->currency); $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); $pricing->insertPricing(4, $domain_id, $request->currency, $request->price, $request->payment_term, $as_usd, $request->next_due_date);
Domains::create([ Domains::create([
@ -66,6 +59,7 @@ class DomainsController extends Controller
Labels::insertLabelsAssigned([$request->label1, $request->label2, $request->label3, $request->label4], $domain_id); Labels::insertLabelsAssigned([$request->label1, $request->label2, $request->label3, $request->label4], $domain_id);
Cache::forget("all_domains");
Home::homePageCacheForget(); Home::homePageCacheForget();
return redirect()->route('domains.index') return redirect()->route('domains.index')
@ -74,11 +68,8 @@ class DomainsController extends Controller
public function edit(Domains $domain) public function edit(Domains $domain)
{ {
$domain_info = Domains::domainsDataEditPage($domain->id); $domain_info = Domains::domain($domain->id)[0];
return view('domains.edit', compact(['domain_info']));
$labels = Labels::labelsForService($domain->id);
return view('domains.edit', compact(['domain', 'domain_info', 'labels']));
} }
public function update(Request $request, Domains $domain) public function update(Request $request, Domains $domain)
@ -91,9 +82,7 @@ class DomainsController extends Controller
]); ]);
$pricing = new Pricing(); $pricing = new Pricing();
$as_usd = $pricing->convertToUSD($request->price, $request->currency); $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); $pricing->updatePricing($domain->id, $request->currency, $request->price, $request->payment_term, $as_usd, $request->next_due_date);
$domain->update([ $domain->update([
@ -108,9 +97,10 @@ class DomainsController extends Controller
]); ]);
Labels::deleteLabelsAssignedTo($domain->id); Labels::deleteLabelsAssignedTo($domain->id);
Labels::insertLabelsAssigned([$request->label1, $request->label2, $request->label3, $request->label4], $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}"); Cache::forget("labels_for_service.{$domain->id}");
Home::homePageCacheForget(); Home::homePageCacheForget();
@ -121,7 +111,6 @@ class DomainsController extends Controller
public function destroy(Domains $domain) public function destroy(Domains $domain)
{ {
$items = Domains::find($domain->id); $items = Domains::find($domain->id);
$items->delete(); $items->delete();
$p = new Pricing(); $p = new Pricing();
@ -129,6 +118,8 @@ class DomainsController extends Controller
Labels::deleteLabelsAssignedTo($domain->id); Labels::deleteLabelsAssignedTo($domain->id);
Cache::forget("all_domains");
Cache::forget("domain.{$domain->id}");
Home::homePageCacheForget(); Home::homePageCacheForget();
return redirect()->route('domains.index') return redirect()->route('domains.index')

View File

@ -14,10 +14,7 @@ class MiscController extends Controller
{ {
public function index() public function index()
{ {
$misc = DB::table('misc_services as d') $misc = Misc::allMisc();
->join('pricings as pr', 'd.id', '=', 'pr.service_id')
->get(['d.*', 'pr.*']);
return view('misc.index', compact(['misc'])); return view('misc.index', compact(['misc']));
} }
@ -28,12 +25,8 @@ class MiscController extends Controller
public function show(Misc $misc) public function show(Misc $misc)
{ {
$service_extras = DB::table('misc_services as m') $misc_data = Misc::misc($misc->id)[0];
->join('pricings as p', 'm.id', '=', 'p.service_id') return view('misc.show', compact(['misc_data']));
->where('m.id', '=', $misc->id)
->get(['m.*', 'p.*']);
return view('misc.show', compact(['misc', 'service_extras']));
} }
public function store(Request $request) public function store(Request $request)
@ -45,20 +38,19 @@ class MiscController extends Controller
'next_due_date' => 'required|date' 'next_due_date' => 'required|date'
]); ]);
$ms_id = Str::random(8); $misc_id = Str::random(8);
$pricing = new Pricing(); $pricing = new Pricing();
$as_usd = $pricing->convertToUSD($request->price, $request->currency); $as_usd = $pricing->convertToUSD($request->price, $request->currency);
$pricing->insertPricing(5, $misc_id, $request->currency, $request->price, $request->payment_term, $as_usd, $request->next_due_date);
$pricing->insertPricing(5, $ms_id, $request->currency, $request->price, $request->payment_term, $as_usd, $request->next_due_date);
Misc::create([ Misc::create([
'id' => $ms_id, 'id' => $misc_id,
'name' => $request->name, 'name' => $request->name,
'owned_since' => $request->owned_since 'owned_since' => $request->owned_since
]); ]);
Cache::forget("all_misc");
Home::homePageCacheForget(); Home::homePageCacheForget();
return redirect()->route('misc.index') return redirect()->route('misc.index')
@ -67,12 +59,8 @@ class MiscController extends Controller
public function edit(Misc $misc) public function edit(Misc $misc)
{ {
$misc = DB::table('misc_services as s') $misc_data = Misc::misc($misc->id)[0];
->join('pricings as p', 's.id', '=', 'p.service_id') return view('misc.edit', compact('misc_data'));
->where('s.id', '=', $misc->id)
->get(['s.*', 'p.*']);
return view('misc.edit', compact('misc'));
} }
public function update(Request $request, Misc $misc) public function update(Request $request, Misc $misc)
@ -91,11 +79,11 @@ class MiscController extends Controller
]); ]);
$pricing = new Pricing(); $pricing = new Pricing();
$as_usd = $pricing->convertToUSD($request->price, $request->currency); $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); $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(); Home::homePageCacheForget();
return redirect()->route('misc.index') return redirect()->route('misc.index')
@ -105,12 +93,13 @@ class MiscController extends Controller
public function destroy(Misc $misc) public function destroy(Misc $misc)
{ {
$items = Misc::find($misc->id); $items = Misc::find($misc->id);
$items->delete(); $items->delete();
$p = new Pricing(); $p = new Pricing();
$p->deletePricing($misc->id); $p->deletePricing($misc->id);
Cache::forget("all_misc");
Cache::forget("misc.{$misc->id}");
Home::homePageCacheForget(); Home::homePageCacheForget();
return redirect()->route('misc.index') return redirect()->route('misc.index')

View File

@ -18,16 +18,13 @@ class ResellerController extends Controller
{ {
public function index() public function index()
{ {
$resellers = Reseller::resellerDataIndexPage(); $resellers = Reseller::allResellerHosting();
return view('reseller.index', compact(['resellers'])); return view('reseller.index', compact(['resellers']));
} }
public function create() public function create()
{ {
$Providers = Providers::allProviders(); return view('reseller.create');
$Locations = Locations::allLocations();
return view('reseller.create', compact(['Providers', 'Locations']));
} }
public function store(Request $request) public function store(Request $request)
@ -60,9 +57,7 @@ class ResellerController extends Controller
$reseller_id = Str::random(8); $reseller_id = Str::random(8);
$pricing = new Pricing(); $pricing = new Pricing();
$as_usd = $pricing->convertToUSD($request->price, $request->currency); $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); $pricing->insertPricing(3, $reseller_id, $request->currency, $request->price, $request->payment_term, $as_usd, $request->next_due_date);
if (!is_null($request->dedicated_ip)) { if (!is_null($request->dedicated_ip)) {
@ -91,32 +86,23 @@ class ResellerController extends Controller
'db_limit' => $request->db 'db_limit' => $request->db
]); ]);
Cache::forget("all_reseller");
Home::homePageCacheForget(); Home::homePageCacheForget();
return redirect()->route('reseller.index') return redirect()->route('reseller.index')
->with('success', 'Reseller hosting created Successfully.'); ->with('success', 'Reseller hosting created Successfully.');
} }
public function show(Reseller $reseller) public function show(Reseller $reseller)
{ {
$reseller_extras = Reseller::resellerDataShowPage($reseller->id); $reseller = Reseller::resellerHosting($reseller->id)[0];
return view('reseller.show', compact(['reseller']));
$labels = Labels::labelsForService($reseller->id);
$ip_address = IPs::ipsForServer($reseller->id);
return view('reseller.show', compact(['reseller', 'reseller_extras', 'labels', 'ip_address']));
} }
public function edit(Reseller $reseller) public function edit(Reseller $reseller)
{ {
$labels = Labels::labelsForService($reseller->id); $reseller = Reseller::resellerHosting($reseller->id)[0];
return view('reseller.edit', compact(['reseller']));
$ip_address = IPs::ipsForServer($reseller->id);
$reseller = Reseller::resellerDataEditPage($reseller->id);
return view('reseller.edit', compact(['reseller', 'ip_address', 'labels']));
} }
public function update(Request $request, Reseller $reseller) public function update(Request $request, Reseller $reseller)
@ -164,13 +150,10 @@ class ResellerController extends Controller
]); ]);
$pricing = new Pricing(); $pricing = new Pricing();
$as_usd = $pricing->convertToUSD($request->price, $request->currency); $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); $pricing->updatePricing($request->id, $request->currency, $request->price, $request->payment_term, $as_usd, $request->next_due_date);
Labels::deleteLabelsAssignedTo($request->id); Labels::deleteLabelsAssignedTo($request->id);
Labels::insertLabelsAssigned([$request->label1, $request->label2, $request->label3, $request->label4], $request->id); Labels::insertLabelsAssigned([$request->label1, $request->label2, $request->label3, $request->label4], $request->id);
IPs::deleteIPsAssignedTo($request->id); IPs::deleteIPsAssignedTo($request->id);
@ -179,6 +162,7 @@ class ResellerController extends Controller
IPs::insertIP($request->id, $request->dedicated_ip); IPs::insertIP($request->id, $request->dedicated_ip);
} }
Cache::forget("reseller_hosting.{$request->id}");
Cache::forget("labels_for_service.{$request->id}"); Cache::forget("labels_for_service.{$request->id}");
Home::homePageCacheForget(); Home::homePageCacheForget();
@ -189,18 +173,19 @@ class ResellerController extends Controller
public function destroy(Reseller $reseller) public function destroy(Reseller $reseller)
{ {
$id = $reseller->id; $reseller_id = $reseller->id;
$items = Reseller::find($id); $items = Reseller::find($reseller_id);
$items->delete(); $items->delete();
$p = new Pricing(); $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(); Home::homePageCacheForget();
return redirect()->route('reseller.index') return redirect()->route('reseller.index')

View File

@ -17,8 +17,7 @@ class SeedBoxesController extends Controller
{ {
public function index() public function index()
{ {
$seedboxes = SeedBoxes::seedBoxesDataIndexPage(); $seedboxes = SeedBoxes::allSeedboxes();
return view('seedboxes.index', compact(['seedboxes'])); return view('seedboxes.index', compact(['seedboxes']));
} }
@ -48,13 +47,10 @@ class SeedBoxesController extends Controller
$seedbox_id = Str::random(8); $seedbox_id = Str::random(8);
$pricing = new Pricing(); $pricing = new Pricing();
$as_usd = $pricing->convertToUSD($request->price, $request->currency); $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); $pricing->insertPricing(6, $seedbox_id, $request->currency, $request->price, $request->payment_term, $as_usd, $request->next_due_date);
Labels::deleteLabelsAssignedTo($seedbox_id); Labels::deleteLabelsAssignedTo($seedbox_id);
Labels::insertLabelsAssigned([$request->label1, $request->label2, $request->label3, $request->label4], $seedbox_id); Labels::insertLabelsAssigned([$request->label1, $request->label2, $request->label3, $request->label4], $seedbox_id);
SeedBoxes::create([ SeedBoxes::create([
@ -73,6 +69,7 @@ class SeedBoxesController extends Controller
'was_promo' => $request->was_promo 'was_promo' => $request->was_promo
]); ]);
Cache::forget("all_seedboxes");
Home::homePageCacheForget(); Home::homePageCacheForget();
return redirect()->route('seedboxes.index') return redirect()->route('seedboxes.index')
@ -82,20 +79,14 @@ class SeedBoxesController extends Controller
public function show(SeedBoxes $seedbox) public function show(SeedBoxes $seedbox)
{ {
$seedbox_extras = SeedBoxes::seedBoxDataShowPage($seedbox->id); $seedbox_data = SeedBoxes::seedbox($seedbox->id)[0];
return view('seedboxes.show', compact(['seedbox_data']));
$labels = Labels::labelsForService($seedbox->id);
return view('seedboxes.show', compact(['seedbox', 'seedbox_extras', 'labels']));
} }
public function edit(SeedBoxes $seedbox) public function edit(SeedBoxes $seedbox)
{ {
$seedbox = SeedBoxes::seedBoxEditDataPage($seedbox->id); $seedbox_data = SeedBoxes::seedbox($seedbox->id)[0];
return view('seedboxes.edit', compact(['seedbox_data']));
$labels = Labels::labelsForService($seedbox[0]->id);
return view('seedboxes.edit', compact(['seedbox', 'labels']));
} }
public function update(Request $request, SeedBoxes $seedbox) public function update(Request $request, SeedBoxes $seedbox)
@ -134,17 +125,15 @@ class SeedBoxesController extends Controller
]); ]);
$pricing = new Pricing(); $pricing = new Pricing();
$as_usd = $pricing->convertToUSD($request->price, $request->currency); $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); $pricing->updatePricing($seedbox->id, $request->currency, $request->price, $request->payment_term, $as_usd, $request->next_due_date);
Labels::deleteLabelsAssignedTo($seedbox->id); Labels::deleteLabelsAssignedTo($seedbox->id);
Labels::insertLabelsAssigned([$request->label1, $request->label2, $request->label3, $request->label4], $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}"); Cache::forget("labels_for_service.{$seedbox->id}");
Home::homePageCacheForget(); Home::homePageCacheForget();
return redirect()->route('seedboxes.index') return redirect()->route('seedboxes.index')
@ -162,6 +151,8 @@ class SeedBoxesController extends Controller
Labels::deleteLabelsAssignedTo($seedbox_id); Labels::deleteLabelsAssignedTo($seedbox_id);
Cache::forget("all_seedboxes");
Cache::forget("seedbox.{$seedbox->id}");
Home::homePageCacheForget(); Home::homePageCacheForget();
return redirect()->route('seedboxes.index') return redirect()->route('seedboxes.index')

View File

@ -30,6 +30,7 @@ class SettingsController extends Controller
'show_server_value_location' => 'required|boolean', 'show_server_value_location' => 'required|boolean',
'show_server_value_price' => 'required|boolean', 'show_server_value_price' => 'required|boolean',
'show_server_value_yabs' => 'required|boolean', 'show_server_value_yabs' => 'required|boolean',
'save_yabs_as_txt' => 'required|boolean',
'default_currency' => 'required', 'default_currency' => 'required',
'default_server_os' => 'required', 'default_server_os' => 'required',
'due_soon_amount' => 'required|integer|between:0,12', '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_location' => $request->show_server_value_location,
'show_server_value_price' => $request->show_server_value_price, 'show_server_value_price' => $request->show_server_value_price,
'show_server_value_yabs' => $request->show_server_value_yabs, 'show_server_value_yabs' => $request->show_server_value_yabs,
'save_yabs_as_txt' => $request->save_yabs_as_txt,
'default_currency' => $request->default_currency, 'default_currency' => $request->default_currency,
'default_server_os' => $request->default_server_os, 'default_server_os' => $request->default_server_os,
'due_soon_amount' => $request->due_soon_amount, 'due_soon_amount' => $request->due_soon_amount,

View File

@ -97,7 +97,7 @@ class SharedController extends Controller
public function edit(Shared $shared) public function edit(Shared $shared)
{ {
$shared = Shared::sharedHosting($shared->id); $shared = Shared::sharedHosting($shared->id)[0];
return view('shared.edit', compact(['shared'])); return view('shared.edit', compact(['shared']));
} }

View File

@ -52,12 +52,18 @@ class YabsController extends Controller
'ram' => $yabs['ram'], 'ram' => $yabs['ram'],
'ram_type' => $yabs['ram_type'], 'ram_type' => $yabs['ram_type'],
'ram_mb' => $yabs['ram_mb'], 'ram_mb' => $yabs['ram_mb'],
'swap' => $yabs['swap'],
'swap_type' => $yabs['swap_type'],
'swap_mb' => $yabs['swap_mb'],
'disk' => $yabs['disk'], 'disk' => $yabs['disk'],
'disk_type' => $yabs['disk_type'], 'disk_type' => $yabs['disk_type'],
'disk_gb' => $yabs['disk_gb'], 'disk_gb' => $yabs['disk_gb'],
'gb5_single' => $yabs['GB5_single'], 'gb5_single' => $yabs['GB5_single'],
'gb5_multi' => $yabs['GB5_mult'], '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([ DiskSpeed::create([
@ -159,4 +165,11 @@ class YabsController extends Controller
return view('yabs.compare', compact('yabs1_data', 'yabs2_data')); 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);
}
} }

View File

@ -4,6 +4,7 @@ namespace App\Models;
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\DB; use Illuminate\Support\Facades\DB;
class Domains extends Model class Domains extends Model
@ -12,30 +13,39 @@ class Domains extends Model
public $incrementing = false; 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']; protected $fillable = ['id', 'domain', 'extension', 'ns1', 'ns2', 'ns3', 'price', 'currency', 'payment_term', 'owned_since', 'provider_id', 'next_due_date'];
public static function domainsDataIndexPage()
{ public static function allDomains()
return DB::table('domains as d') {//All domains and relationships (no using joins)
->join('providers as p', 'd.provider_id', '=', 'p.id') return Cache::remember("all_domains", now()->addMonth(1), function () {
->join('pricings as pr', 'd.id', '=', 'pr.service_id') return Domains::with(['provider', 'price', 'labels', 'labels.label'])->get();
->get(['d.*', 'p.name as provider_name', 'pr.*']); });
} }
public static function domainsDataShowPage(string $domain_id) public static function domain(string $domain_id)
{ {//Single domains and relationships (no using joins)
return DB::table('domains as d') return Cache::remember("domain.$domain_id", now()->addMonth(1), function () use ($domain_id) {
->join('providers as p', 'd.provider_id', '=', 'p.id') return Domains::where('id', $domain_id)
->join('pricings as pr', 'd.id', '=', 'pr.service_id') ->with(['provider', 'price', 'labels', 'labels.label'])->get();
->where('d.id', '=', $domain_id) });
->get(['d.*', 'p.name as provider_name', 'pr.*']);
} }
public static function domainsDataEditPage(string $domain_id) public function provider()
{ {
return DB::table('domains as d') return $this->hasOne(Providers::class, 'id', 'provider_id');
->join('pricings as pr', 'd.id', '=', 'pr.service_id')
->where('d.id', '=', $domain_id)
->get(['d.*', 'pr.*']);
} }
public function price()
{
return $this->hasOne(Pricing::class, 'service_id', 'id');
}
public function labels()
{
return $this->hasMany(LabelsAssigned::class, 'service_id', 'id');
}
} }

View File

@ -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 $this->hasMany(LabelsAssigned::class, 'label_id', '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']);
});
} }
} }

View File

@ -4,6 +4,7 @@ namespace App\Models;
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;
class Misc extends Model class Misc extends Model
{ {
@ -14,4 +15,25 @@ class Misc extends Model
protected $table = 'misc_services'; protected $table = 'misc_services';
protected $fillable = ['id', 'name', 'owned_since']; 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');
}
} }

View File

@ -17,32 +17,44 @@ class Reseller extends Model
public $incrementing = false; public $incrementing = false;
public static function resellerDataIndexPage() public static function allResellerHosting()
{ {//All reseller hosting and relationships (no using joins)
return DB::table('reseller_hosting as s') return Cache::remember("all_reseller", now()->addMonth(1), function () {
->join('providers as p', 's.provider_id', '=', 'p.id') return Reseller::with(['location', 'provider', 'price', 'ips', 'labels', 'labels.label'])->get();
->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 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') return $this->hasMany(IPs::class, 'service_id', 'id');
->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.*']);
} }
public static function resellerDataEditPage(string $reseller_id) public function location()
{ {
return DB::table('reseller_hosting as s') return $this->hasOne(Locations::class, 'id', 'location_id');
->join('pricings as p', 's.id', '=', 'p.service_id') }
->where('s.id', '=', $reseller_id)
->get(['s.*', 'p.*']);
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');
} }
} }

View File

@ -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']; 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() public static function allSeedboxes()
{ {//All seedboxes and relationships (no using joins)
return DB::table('seedboxes as s') return Cache::remember("all_seedboxes", now()->addMonth(1), function () {
->join('providers as p', 's.provider_id', '=', 'p.id') return SeedBoxes::with(['location', 'provider', 'price', 'labels.label'])->get();
->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 seedBoxDataShowPage(string $seed_box_id) public static function seedbox(string $seedbox_id)
{ {//Single seedbox and relationships (no using joins)
return DB::table('seedboxes as s') return Cache::remember("seedbox.$seedbox_id", now()->addMonth(1), function () use ($seedbox_id) {
->join('pricings as pr', 's.id', '=', 'pr.service_id') return SeedBoxes::where('id', $seedbox_id)
->join('providers as p', 's.provider_id', '=', 'p.id') ->with(['location', 'provider', 'price', 'labels.label'])->get();
->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 seedBoxEditDataPage(string $seed_box_id) public function location()
{ {
return DB::table('seedboxes as s') return $this->hasOne(Locations::class, 'id', 'location_id');
->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 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');
}
} }

View File

@ -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_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_provider', $settings[0]->show_server_value_provider ?? 0);
Session::put('show_server_value_location', $settings[0]->show_server_value_location ?? 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_currency', $settings[0]->default_currency ?? 'USD');
Session::put('default_server_os', $settings[0]->default_server_os ?? 1); Session::put('default_server_os', $settings[0]->default_server_os ?? 1);
Session::put('due_soon_amount', $settings[0]->due_soon_amount ?? 6); Session::put('due_soon_amount', $settings[0]->due_soon_amount ?? 6);

View File

@ -15,30 +15,12 @@ class Yabs extends Model
protected $table = 'yabs'; 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 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) public static function yabs(string $yabs_id)
{ {
return Cache::remember("yabs.$yabs_id", now()->addMonth(1), function () use ($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(); ->get();
}); });
} }
@ -46,7 +28,7 @@ class Yabs extends Model
public static function allYabs() public static function allYabs()
{ {
return Cache::remember("all_yabs", now()->addMonth(1), function () { 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(); ->get();
}); });
} }
@ -66,4 +48,55 @@ class Yabs extends Model
return $this->hasMany(NetworkSpeed::class, 'id', 'id'); 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,
'uptime' => $data->uptime,
'distro' => $data->distro,
'kernel' => $data->kernel,
'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,
'swap' => array(
'amount' => $data->swap ?? null . ' ' . $data->swap_type ?? null,
'mb' => $data->swap_mb ?? null,
),
),
'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
),
);
}
} }

View File

@ -3,6 +3,7 @@
namespace App; namespace App;
use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Session;
use Illuminate\Support\Facades\Storage; use Illuminate\Support\Facades\Storage;
class Process class Process
@ -169,22 +170,24 @@ class Process
public function yabsOutputAsJson(string $server_id, string $data_from_form): array 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']; $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); Storage::disk('local')->put($file_name, $data_from_form);
$file = Storage::disk('local')->get($file_name); $file = Storage::disk('local')->get($file_name);
if ($file) { if ($file) {
$array = explode("\n", $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 { } else {
return array('error_id' => 10, 'error_message' => 'Issue writing/reading txt file'); 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) { if (count($array) < 46) {
return array('error_id' => 9, 'error_message' => 'Less than 46 lines'); 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])); $io_6 = explode(' ', preg_replace('!\s+!', ' ', $array[33]));
(str_contains($array[13], 'Enabled')) ? $aes_ni = true : $aes_ni = false; (str_contains($array[13], 'Enabled')) ? $aes_ni = true : $aes_ni = false;
(str_contains($array[14], 'Enabled')) ? $vm_amd_v = true : $vm_amd_v = 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 { } else {
$cpu = $this->trimRemoveR(str_replace(':', '', strstr($array[10], ': '))); $cpu = $this->trimRemoveR(str_replace(':', '', strstr($array[10], ': ')));
$cpu_spec = explode(' ', strstr($array[11], ': '));//: 2 @ 3792.872 MHz $cpu_spec = explode(' ', strstr($array[11], ': '));//: 2 @ 3792.872 MHz
@ -304,7 +310,7 @@ class Process
$gb_s = 60; $gb_s = 60;
$gb_m = 61; $gb_m = 61;
$gb_url = 62; $gb_url = 62;
}elseif ($array[59] === "Geekbench 5 Benchmark Test:\r") { } elseif ($array[59] === "Geekbench 5 Benchmark Test:\r") {
//HAS ipv6 //HAS ipv6
//Has full ipv4 & ipv6 network speed testing //Has full ipv4 & ipv6 network speed testing
$has_ipv6 = true; $has_ipv6 = true;
@ -397,7 +403,10 @@ class Process
'vm' => $vm_amd_v, 'vm' => $vm_amd_v,
'GB5_single' => $geekbench_single, 'GB5_single' => $geekbench_single,
'GB5_mult' => $geekbench_multi, '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; $output['disk_speed'] = $disk_test_arr;

View File

@ -0,0 +1,31 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration {
public function up()
{
Schema::table('yabs', function (Blueprint $table) {
$table->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');
});
}
};

View File

@ -0,0 +1,22 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up()
{
Schema::table('settings', function (Blueprint $table) {
$table->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');
});
}
};

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,4 @@
<a href="{{$route}}" class="btn btn-success btn-sm mx-1">
<i class="fas fa-arrow-left me-1"></i>
{{$text ?? 'Go back'}}
</a>

View File

@ -0,0 +1,4 @@
<a href="{{$route}}" class="btn btn-primary btn-sm mx-1">
<i class="fas fa-pen me-1"></i>
{{$text ?? 'Edit'}}
</a>

View File

@ -1,7 +1,7 @@
@section('title') {{'Edit domain'}} @endsection @section('title') {{'Edit domain'}} @endsection
<x-app-layout> <x-app-layout>
<x-slot name="header"> <x-slot name="header">
Edit {{ $domain->domain }}.{{ $domain->extension }} Edit {{ $domain_info->domain }}.{{ $domain_info->extension }}
</x-slot> </x-slot>
<div class="container"> <div class="container">
<x-card class="shadow mt-3"> <x-card class="shadow mt-3">
@ -11,7 +11,7 @@
Go back Go back
</x-back-button> </x-back-button>
<x-errors-alert></x-errors-alert> <x-errors-alert></x-errors-alert>
<form action="{{ route('domains.update', $domain->id) }}" method="POST"> <form action="{{ route('domains.update', $domain_info->id) }}" method="POST">
@csrf @csrf
@method('PUT') @method('PUT')
<div class="row mt-4"> <div class="row mt-4">
@ -22,7 +22,7 @@
<input type="text" <input type="text"
class="form-control" class="form-control"
name="domain" name="domain"
value="{{ $domain->domain }}"> value="{{ $domain_info->domain }}">
@error('name') <span class="text-red-500">{{ $message }} @error('name') <span class="text-red-500">{{ $message }}
</span>@enderror </span>@enderror
</div> </div>
@ -31,7 +31,7 @@
<x-text-input> <x-text-input>
<x-slot name="title">Extension</x-slot> <x-slot name="title">Extension</x-slot>
<x-slot name="name">extension</x-slot> <x-slot name="name">extension</x-slot>
<x-slot name="value">{{ $domain->extension }}</x-slot> <x-slot name="value">{{ $domain_info->extension }}</x-slot>
</x-text-input> </x-text-input>
</div> </div>
</div> </div>
@ -41,7 +41,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">{{$domain->ns1}}</x-slot> <x-slot name="value">{{$domain_info->ns1}}</x-slot>
</x-text-input> </x-text-input>
</div> </div>
<div class="col-12 col-lg-4 mb-4"> <div class="col-12 col-lg-4 mb-4">
@ -49,7 +49,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">{{$domain->ns2}}</x-slot> <x-slot name="value">{{$domain_info->ns2}}</x-slot>
</x-text-input> </x-text-input>
</div> </div>
<div class="col-12 col-lg-4 mb-4"> <div class="col-12 col-lg-4 mb-4">
@ -57,7 +57,7 @@
<x-slot name="title">NS3</x-slot> <x-slot name="title">NS3</x-slot>
<x-slot name="name">ns3</x-slot> <x-slot name="name">ns3</x-slot>
<x-slot name="max">255</x-slot> <x-slot name="max">255</x-slot>
<x-slot name="value">{{$domain->ns3}}</x-slot> <x-slot name="value">{{$domain_info->ns3}}</x-slot>
</x-text-input> </x-text-input>
</div> </div>
</div> </div>
@ -65,7 +65,7 @@
<div class="col-md-3 mb-3"> <div class="col-md-3 mb-3">
<x-providers-select> <x-providers-select>
<x-slot name="current"> <x-slot name="current">
{{$domain->provider_id}} {{$domain_info->provider->id}}
</x-slot> </x-slot>
</x-providers-select> </x-providers-select>
</div> </div>
@ -74,17 +74,17 @@
<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="step">0.01</x-slot> <x-slot name="step">0.01</x-slot>
<x-slot name="value">{{ $domain_info[0]->price }}</x-slot> <x-slot name="value">{{ $domain_info->price->price }}</x-slot>
</x-number-input> </x-number-input>
</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">{{$domain_info[0]->term}}</x-slot> <x-slot name="current">{{$domain_info->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">{{$domain_info[0]->currency}}</x-slot> <x-slot name="current">{{$domain_info->price->currency}}</x-slot>
</x-currency-select> </x-currency-select>
</div> </div>
</div> </div>
@ -93,14 +93,14 @@
<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">{{$domain_info[0]->owned_since }}</x-slot> <x-slot name="value">{{$domain_info->owned_since }}</x-slot>
</x-date-input> </x-date-input>
</div> </div>
<div class="col-12 col-md-4 mb-3"> <div class="col-12 col-md-4 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">{{$domain_info[0]->next_due_date}}</x-slot> <x-slot name="value">{{$domain_info->price->next_due_date}}</x-slot>
</x-date-input> </x-date-input>
</div> </div>
</div> </div>
@ -110,8 +110,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($domain_info->labels[0]->label))
<x-slot name="current">{{$labels[0]->id}}</x-slot> <x-slot name="current">{{$domain_info->labels[0]->label->id}}</x-slot>
@endif @endif
</x-labels-select> </x-labels-select>
</div> </div>
@ -119,8 +119,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($domain_info->labels[1]->label))
<x-slot name="current">{{$labels[1]->id}}</x-slot> <x-slot name="current">{{$domain_info->labels[1]->label->id}}</x-slot>
@endif @endif
</x-labels-select> </x-labels-select>
</div> </div>
@ -128,8 +128,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($domain_info->labels[2]->label))
<x-slot name="current">{{$labels[2]->id}}</x-slot> <x-slot name="current">{{$domain_info->labels[2]->label->id}}</x-slot>
@endif @endif
</x-labels-select> </x-labels-select>
</div> </div>
@ -137,8 +137,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">label4</x-slot> <x-slot name="name">label4</x-slot>
@if(isset($labels[3]->id)) @if(isset($domain_info->labels[3]->label))
<x-slot name="current">{{$labels[3]->id}}</x-slot> <x-slot name="current">{{$domain_info->labels[3]->label->id}}</x-slot>
@endif @endif
</x-labels-select> </x-labels-select>
</div> </div>
@ -146,7 +146,7 @@
<div class="form-check mt-2"> <div class="form-check mt-2">
<input class="form-check-input" name="is_active" type="checkbox" <input class="form-check-input" name="is_active" type="checkbox"
value="1" {{ ($domain_info[0]->active === 1) ? 'checked' : '' }}> value="1" {{ ($domain_info->active === 1) ? 'checked' : '' }}>
<label class="form-check-label"> <label class="form-check-label">
I still have this service I still have this service
</label> </label>

View File

@ -34,22 +34,22 @@
<td class="text-nowrap"><a href="https://{{ $domain->domain }}.{{$domain->extension}}" <td class="text-nowrap"><a href="https://{{ $domain->domain }}.{{$domain->extension}}"
class="text-decoration-none">{{ $domain->domain }}.{{$domain->extension}}</a></td> class="text-decoration-none">{{ $domain->domain }}.{{$domain->extension}}</a></td>
<td class="text-nowrap">{{ $domain->owned_since}}</td> <td class="text-nowrap">{{ $domain->owned_since}}</td>
<td class="text-nowrap">{{ now()->diffInDays($domain->next_due_date) }} <small>days</small> <td class="text-nowrap">{{ now()->diffInDays($domain->price->next_due_date) }} <small>days</small>
</td> </td>
<td class="text-nowrap">{{ $domain->provider_name}}</td> <td class="text-nowrap">{{ $domain->provider->name}}</td>
<td class="text-nowrap">{{ $domain->price }} <small>{{$domain->currency}}</small></td> <td class="text-nowrap">{{ $domain->price->price }} <small>{{$domain->price->currency}}</small></td>
<td class="text-nowrap"> <td class="text-nowrap">
<form action="{{ route('domains.destroy', $domain->service_id) }}" method="POST"> <form action="{{ route('domains.destroy', $domain->id) }}" method="POST">
<a href="{{ route('domains.show', $domain->service_id) }}" <a href="{{ route('domains.show', $domain->id) }}"
class="text-body mx-1"> class="text-body mx-1">
<i class="fas fa-eye" title="view"></i></a> <i class="fas fa-eye" title="view"></i></a>
<a href="{{ route('domains.edit', $domain->service_id) }}" <a href="{{ route('domains.edit', $domain->id) }}"
class="text-body mx-1"> class="text-body mx-1">
<i class="fas fa-pen" title="edit"></i></a> <i class="fas fa-pen" title="edit"></i></a>
@csrf @csrf
@method('DELETE') @method('DELETE')
<i class="fas fa-trash text-danger ms-3" @click="modalForm" <i class="fas fa-trash text-danger ms-3" @click="modalForm"
id="btn-{{$domain->domain}}" title="{{$domain->service_id}}"></i> id="btn-{{$domain->domain}}" title="{{$domain->id}}"></i>
</form> </form>
</td> </td>
</tr> </tr>

View File

@ -1,4 +1,6 @@
@section('title') {{ $domain->domain }}.{{$domain->extension}} {{'domain'}} @endsection @section('title')
{{ $domain_info->domain }}.{{$domain_info->extension}} {{'domain'}}
@endsection
<x-app-layout> <x-app-layout>
<x-slot name="header"> <x-slot name="header">
{{ __('Domain details') }} {{ __('Domain 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>{{ $domain->domain }}.{{$domain->extension}}</h2> <h2>{{ $domain_info->domain }}.{{$domain_info->extension}}</h2>
<code>@foreach($labels as $label) @foreach($domain_info->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">{{ $domain->id }}</h6> <h6 class="text-muted pe-lg-4">{{ $domain_info->id }}</h6>
@if($domain->active !== 1) @if($domain_info->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>
@ -30,57 +28,59 @@
<tbody> <tbody>
<tr> <tr>
<td class="px-2 py-2 font-bold text-muted">Domain</td> <td class="px-2 py-2 font-bold text-muted">Domain</td>
<td><a href="https://{{ $domain->domain }}.{{$domain->extension}}" class="text-decoration-none">{{ $domain->domain }}.{{$domain->extension}}</a></td> <td><a href="https://{{ $domain_info->domain }}.{{$domain_info->extension}}"
class="text-decoration-none">{{ $domain_info->domain }}
.{{$domain_info->extension}}</a></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>{{ $service_extras[0]->provider_name }}</td> <td>{{ $domain_info->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>{{ $service_extras[0]->price }} {{ $service_extras[0]->currency }} <td>{{ $domain_info->price->price }} {{ $domain_info->price->currency }}
<small>{{\App\Process::paymentTermIntToString($service_extras[0]->term)}}</small> <small>{{\App\Process::paymentTermIntToString($domain_info->price->term)}}</small>
</td> </td>
</tr> </tr>
<tr> <tr>
<td class="px-2 py-2 font-bold text-muted">NS1</td> <td class="px-2 py-2 font-bold text-muted">NS1</td>
<td>{{ $domain->ns1 }}</td> <td>{{ $domain_info->ns1 }}</td>
</tr> </tr>
<tr> <tr>
<td class="px-2 py-2 font-bold text-muted">NS2</td> <td class="px-2 py-2 font-bold text-muted">NS2</td>
<td>{{ $domain->ns2 }}</td> <td>{{ $domain_info->ns2 }}</td>
</tr> </tr>
<tr> <tr>
<td class="px-2 py-2 font-bold text-muted">NS3</td> <td class="px-2 py-2 font-bold text-muted">NS3</td>
<td>{{ $domain->ns3 }}</td> <td>{{ $domain_info->ns3 }}</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($domain->owned_since)) @if(!is_null($domain_info->owned_since))
{{ date_format(new DateTime($domain->owned_since), 'jS F Y') }} {{ date_format(new DateTime($domain_info->owned_since), 'jS F Y') }}
@endif @endif
</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($service_extras[0]->next_due_date)->diffForHumans()}} <td>{{Carbon\Carbon::parse($domain_info->price->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)->format('d/m/Y')}})
</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($domain->created_at)) @if(!is_null($domain_info->created_at))
{{ date_format(new DateTime($domain->created_at), 'jS M y g:i a') }} {{ date_format(new DateTime($domain_info->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($domain->updated_at)) @if(!is_null($domain_info->updated_at))
{{ date_format(new DateTime($domain->updated_at), 'jS M y g:i a') }} {{ date_format(new DateTime($domain_info->updated_at), 'jS M y g:i a') }}
@endif @endif
</td> </td>
</tr> </tr>
@ -89,14 +89,12 @@
</div> </div>
</div> </div>
</div> </div>
<a href="{{ route('domains.index') }}" <x-back-btn>
class="btn btn-success btn-sm mx-2"> <x-slot name="route">{{ route('domains.index') }}</x-slot>
Go back </x-back-btn>
</a> <x-edit-btn>
<a href="{{ route('domains.edit', $domain->id) }}" <x-slot name="route">{{ route('domains.edit', $domain_info->id) }}</x-slot>
class="btn btn-primary btn-sm mx-2"> </x-edit-btn>
Edit
</a>
</x-card> </x-card>
</div> </div>
</x-app-layout> </x-app-layout>

View File

@ -1,7 +1,7 @@
@section('title') {{$misc[0]->name}} {{'edit'}} @endsection @section('title') {{$misc_data->name}} {{'edit'}} @endsection
<x-app-layout> <x-app-layout>
<x-slot name="header"> <x-slot name="header">
Edit {{ $misc[0]->name }} Edit {{ $misc_data->name }}
</x-slot> </x-slot>
<div class="container"> <div class="container">
<x-card class="shadow mt-3"> <x-card class="shadow mt-3">
@ -11,7 +11,7 @@
Go back Go back
</x-back-button> </x-back-button>
<x-errors-alert></x-errors-alert> <x-errors-alert></x-errors-alert>
<form action="{{ route('misc.update', $misc[0]->service_id) }}" method="POST"> <form action="{{ route('misc.update', $misc_data->id) }}" method="POST">
@csrf @csrf
@method('PUT') @method('PUT')
<div class="row"> <div class="row">
@ -20,7 +20,7 @@
<div class="input-group-prepend"><span class="input-group-text">Name</span></div> <div class="input-group-prepend"><span class="input-group-text">Name</span></div>
<input type="text" <input type="text"
class="form-control" class="form-control"
name="name" required maxlength="255" value="{{$misc[0]->name}}"> name="name" required maxlength="255" value="{{$misc_data->name}}">
@error('name') <span class="text-red-500">{{ $message }} @error('name') <span class="text-red-500">{{ $message }}
</span>@enderror </span>@enderror
</div> </div>
@ -30,17 +30,17 @@
<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="step">0.01</x-slot> <x-slot name="step">0.01</x-slot>
<x-slot name="value">{{ $misc[0]->price }}</x-slot> <x-slot name="value">{{ $misc_data->price->price }}</x-slot>
</x-number-input> </x-number-input>
</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">{{$misc[0]->term}}</x-slot> <x-slot name="current">{{$misc_data->price->term}}</x-slot>
</x-term-select> </x-term-select>
</div> </div>
<div class="col-md-2 mb-3"> <div class="col-md-2 mb-3">
<x-currency-select> <x-currency-select>
<x-slot name="current">{{$misc[0]->currency}}</x-slot> <x-slot name="current">{{$misc_data->price->currency}}</x-slot>
</x-currency-select> </x-currency-select>
</div> </div>
</div> </div>
@ -49,20 +49,20 @@
<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">{{$misc[0]->owned_since }}</x-slot> <x-slot name="value">{{$misc_data->owned_since }}</x-slot>
</x-date-input> </x-date-input>
</div> </div>
<div class="col-12 col-md-4 mb-3"> <div class="col-12 col-md-4 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">{{$misc[0]->next_due_date}}</x-slot> <x-slot name="value">{{$misc_data->price->next_due_date}}</x-slot>
</x-date-input> </x-date-input>
</div> </div>
</div> </div>
<div class="form-check mt-2"> <div class="form-check mt-2">
<input class="form-check-input" name="is_active" type="checkbox" <input class="form-check-input" name="is_active" type="checkbox"
value="1" {{ ($misc[0]->active === 1) ? 'checked' : '' }}> value="1" {{ ($misc_data->active === 1) ? 'checked' : '' }}>
<label class="form-check-label"> <label class="form-check-label">
I still have this service I still have this service
</label> </label>

View File

@ -36,23 +36,23 @@
{{ date_format(new DateTime($m->owned_since), 'jS F Y') }} {{ date_format(new DateTime($m->owned_since), 'jS F Y') }}
@endif @endif
</td> </td>
<td class="text-nowrap">{{ now()->diffInDays($m->next_due_date) }} <td class="text-nowrap">{{ now()->diffInDays($m->price->next_due_date) }}
<small>days</small></td> <small>days</small></td>
<td class="text-nowrap">{{$m->price}} {{$m->currency}} <td class="text-nowrap">{{$m->price->price}} {{$m->price->currency}}
<small>{{\App\Process::paymentTermIntToString($m->term)}}</small></td> <small>{{\App\Process::paymentTermIntToString($m->price->term)}}</small></td>
<td class="text-nowrap"> <td class="text-nowrap">
<form action="{{ route('misc.destroy', $m->service_id) }}" method="POST"> <form action="{{ route('misc.destroy', $m->id) }}" method="POST">
<a href="{{ route('misc.edit', $m->service_id) }}" <a href="{{ route('misc.edit', $m->id) }}"
class="text-body mx-1"> class="text-body mx-1">
<i class="fas fa-pen" title="edit"></i></a> <i class="fas fa-pen" title="edit"></i></a>
<a href="{{ route('misc.show', $m->service_id) }}" <a href="{{ route('misc.show', $m->id) }}"
class="text-body mx-1"> class="text-body mx-1">
<i class="fas fa-eye" title="view"></i> <i class="fas fa-eye" title="view"></i>
</a> </a>
@csrf @csrf
@method('DELETE') @method('DELETE')
<i class="fas fa-trash text-danger ms-3" @click="modalForm" <i class="fas fa-trash text-danger ms-3" @click="modalForm"
id="btn-{{$m->name}}" title="{{$m->service_id}}"></i> id="btn-{{$m->name}}" title="{{$m->id}}"></i>
</form> </form>
</td> </td>
</tr> </tr>

View File

@ -1,4 +1,4 @@
@section('title') {{ $service_extras[0]->name }} {{'service'}} @endsection @section('title') {{ $misc_data->name }} {{'service'}} @endsection
<x-app-layout> <x-app-layout>
<x-slot name="header"> <x-slot name="header">
{{ __('Misc details') }} {{ __('Misc details') }}
@ -7,11 +7,11 @@
<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>{{ $service_extras[0]->name}}</h2> <h2>{{ $misc_data->name}}</h2>
</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">{{ $service_extras[0]->service_id }}</h6> <h6 class="text-muted pe-lg-4">{{ $misc_data->id }}</h6>
@if($service_extras[0]->active !== 1) @if($misc_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>
@ -23,41 +23,41 @@
<tbody> <tbody>
<tr> <tr>
<td class="px-2 py-2 font-bold text-muted">Service</td> <td class="px-2 py-2 font-bold text-muted">Service</td>
<td>{{ $service_extras[0]->name }}</td> <td>{{ $misc_data->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>{{ $service_extras[0]->price }} {{ $service_extras[0]->currency }} <td>{{ $misc_data->price->price }} {{ $misc_data->price->currency }}
<small>{{\App\Process::paymentTermIntToString($service_extras[0]->term)}}</small> <small>{{\App\Process::paymentTermIntToString($misc_data->price->term)}}</small>
</td> </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($service_extras[0]->owned_since)) @if(!is_null($misc_data->owned_since))
{{ date_format(new DateTime($service_extras[0]->owned_since), 'jS F Y') }} {{ date_format(new DateTime($misc_data->owned_since), 'jS F Y') }}
@endif @endif
</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($service_extras[0]->next_due_date)->diffForHumans()}} <td>{{Carbon\Carbon::parse($misc_data->price->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)->format('d/m/Y')}})
</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($service_extras[0]->created_at)) @if(!is_null($misc_data->created_at))
{{ date_format(new DateTime($service_extras[0]->created_at), 'jS M y g:i a') }} {{ date_format(new DateTime($misc_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($service_extras[0]->updated_at)) @if(!is_null($misc_data->updated_at))
{{ date_format(new DateTime($service_extras[0]->updated_at), 'jS M y g:i a') }} {{ date_format(new DateTime($misc_data->updated_at), 'jS M y g:i a') }}
@endif @endif
</td> </td>
</tr> </tr>
@ -70,7 +70,7 @@
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('misc.edit', $service_extras[0]->service_id) }}" <a href="{{ route('misc.edit', $misc_data->id) }}"
class="btn btn-primary btn-sm mx-2"> class="btn btn-primary btn-sm mx-2">
Edit Edit
</a> </a>

View File

@ -1,7 +1,7 @@
@section('title') {{$reseller[0]->main_domain}} {{'edit'}} @endsection @section('title') {{$reseller->main_domain}} {{'edit'}} @endsection
<x-app-layout> <x-app-layout>
<x-slot name="header"> <x-slot name="header">
Edit {{ $reseller[0]->main_domain }} Edit {{ $reseller->main_domain }}
</x-slot> </x-slot>
<div class="container"> <div class="container">
@ -12,7 +12,7 @@
Back to reseller hosting Back to reseller hosting
</a> </a>
<x-auth-validation-errors></x-auth-validation-errors> <x-auth-validation-errors></x-auth-validation-errors>
<form action="{{ route('reseller.update', $reseller[0]->service_id) }}" method="POST"> <form action="{{ route('reseller.update', $reseller->id) }}" method="POST">
@csrf @csrf
@method('PUT') @method('PUT')
<div class="row mt-3"> <div class="row mt-3">
@ -21,58 +21,58 @@
<div class="input-group-prepend"><span class="input-group-text">Domain</span></div> <div class="input-group-prepend"><span class="input-group-text">Domain</span></div>
<input type="text" <input type="text"
class="form-control" class="form-control"
name="domain" value="{{$reseller[0]->main_domain}}"> name="domain" value="{{$reseller->main_domain}}">
@error('name') <span class="text-red-500">{{ $message }} @error('name') <span class="text-red-500">{{ $message }}
</span>@enderror </span>@enderror
</div> </div>
</div> </div>
<div class="col-12 col-lg-3 mb-4"> <div class="col-12 col-lg-3 mb-4">
<input type="hidden" name="id" value="{{$reseller[0]->service_id}}"> <input type="hidden" name="id" value="{{$reseller->id}}">
<div class="input-group"> <div class="input-group">
<div class="input-group-prepend"><span class="input-group-text">Type</span></div> <div class="input-group-prepend"><span class="input-group-text">Type</span></div>
<select class="form-control" name="reseller_type"> <select class="form-control" name="reseller_type">
<option <option
value="ApisCP" {{ ($reseller[0]->reseller_type === 'ApisCP') ? 'selected' : '' }}> value="ApisCP" {{ ($reseller->reseller_type === 'ApisCP') ? 'selected' : '' }}>
ApisCP ApisCP
</option> </option>
<option <option
value="Centos" {{ ($reseller[0]->reseller_type === 'Centos') ? 'selected' : '' }}> value="Centos" {{ ($reseller->reseller_type === 'Centos') ? 'selected' : '' }}>
Centos Centos
</option> </option>
<option <option
value="cPanel" {{ ($reseller[0]->reseller_type === 'cPanel') ? 'selected' : '' }}> value="cPanel" {{ ($reseller->reseller_type === 'cPanel') ? 'selected' : '' }}>
cPanel cPanel
</option> </option>
<option <option
value="Direct Admin" {{ ($reseller[0]->reseller_type === 'Direct Admin') ? 'selected' : '' }}> value="Direct Admin" {{ ($reseller->reseller_type === 'Direct Admin') ? 'selected' : '' }}>
Direct Admin Direct Admin
</option> </option>
<option <option
value="Webmin" {{ ($reseller[0]->reseller_type === 'Webmin') ? 'selected' : '' }}> value="Webmin" {{ ($reseller->reseller_type === 'Webmin') ? 'selected' : '' }}>
Webmin Webmin
</option> </option>
<option <option
value="Moss" {{ ($reseller[0]->reseller_type === 'Moss') ? 'selected' : '' }}> value="Moss" {{ ($reseller->reseller_type === 'Moss') ? 'selected' : '' }}>
Moss Moss
</option> </option>
<option <option
value="Other" {{ ($reseller[0]->reseller_type === 'Other') ? 'selected' : '' }}> value="Other" {{ ($reseller->reseller_type === 'Other') ? 'selected' : '' }}>
Other Other
</option> </option>
<option <option
value="Plesk" {{ ($reseller[0]->reseller_type === 'Plesk') ? 'selected' : '' }}> value="Plesk" {{ ($reseller->reseller_type === 'Plesk') ? 'selected' : '' }}>
Plesk Plesk
</option> </option>
<option <option
value="Run cloud" {{ ($reseller[0]->reseller_type === 'Run cloud') ? 'selected' : '' }}> value="Run cloud" {{ ($reseller->reseller_type === 'Run cloud') ? 'selected' : '' }}>
Run cloud Run cloud
</option> </option>
<option <option
value="Vesta CP" {{ ($reseller[0]->reseller_type === 'Vesta CP') ? 'selected' : '' }}> value="Vesta CP" {{ ($reseller->reseller_type === 'Vesta CP') ? 'selected' : '' }}>
Vesta CP Vesta CP
</option> </option>
<option <option
value="Virtual min" {{ ($reseller[0]->reseller_type === 'Virtual min') ? 'selected' : '' }}> value="Virtual min" {{ ($reseller->reseller_type === 'Virtual min') ? 'selected' : '' }}>
Virtual min Virtual min
</option> </option>
</select> </select>
@ -84,21 +84,21 @@
<x-slot name="name">dedicated_ip</x-slot> <x-slot name="name">dedicated_ip</x-slot>
<x-slot name="max">255</x-slot> <x-slot name="max">255</x-slot>
<x-slot <x-slot
name="value">@if(isset($ip_address[0]['address'])){{$ip_address[0]['address']}}@endif</x-slot> name="value">@if(isset($reseller->ips[0]['address'])){{$reseller->ips[0]['address']}}@endif</x-slot>
</x-text-input> </x-text-input>
</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">{{$reseller[0]->provider_id}}</x-slot> <x-slot name="current">{{$reseller->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">{{$reseller[0]->price}}</x-slot> <x-slot name="value">{{$reseller->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>
@ -106,40 +106,40 @@
</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">{{$reseller[0]->term}}</x-slot> <x-slot name="current">{{$reseller->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">{{$reseller[0]->currency}}</x-slot> <x-slot name="current">{{$reseller->price->currency}}</x-slot>
</x-currency-select> </x-currency-select>
</div> </div>
</div> </div>
<div class="row mb-2"> <div class="row mb-2">
<div class="col-12 col-md-3 mb-3"> <div class="col-12 col-md-3 mb-3">
<x-locations-select> <x-locations-select>
<x-slot name="current">{{$reseller[0]->location_id}}</x-slot> <x-slot name="current">{{$reseller->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-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">{{ $reseller[0]->was_promo }}</x-slot> <x-slot name="value">{{ $reseller->was_promo }}</x-slot>
</x-yes-no-select> </x-yes-no-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">{{$reseller[0]->owned_since }}</x-slot> <x-slot name="value">{{$reseller->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">{{$reseller[0]->next_due_date }}</x-slot> <x-slot name="value">{{$reseller->price->next_due_date }}</x-slot>
</x-date-input> </x-date-input>
</div> </div>
</div> </div>
@ -152,7 +152,7 @@
<x-slot name="value">1</x-slot> <x-slot name="value">1</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">{{$reseller[0]->accounts}}</x-slot> <x-slot name="value">{{$reseller->accounts}}</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">
@ -162,7 +162,7 @@
<x-slot name="value">1</x-slot> <x-slot name="value">1</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">{{$reseller[0]->domains_limit}}</x-slot> <x-slot name="value">{{$reseller->domains_limit}}</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">
@ -172,7 +172,7 @@
<x-slot name="value">1</x-slot> <x-slot name="value">1</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">{{$reseller[0]->subdomains_limit}}</x-slot> <x-slot name="value">{{$reseller->subdomains_limit}}</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">
@ -182,7 +182,7 @@
<x-slot name="value">1</x-slot> <x-slot name="value">1</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">{{$reseller[0]->disk_as_gb}}</x-slot> <x-slot name="value">{{$reseller->disk_as_gb}}</x-slot>
</x-number-input> </x-number-input>
</div> </div>
</div> </div>
@ -194,7 +194,7 @@
<x-slot name="value">1</x-slot> <x-slot name="value">1</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">{{$reseller[0]->email_limit}}</x-slot> <x-slot name="value">{{$reseller->email_limit}}</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">
@ -204,7 +204,7 @@
<x-slot name="value">1</x-slot> <x-slot name="value">1</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">{{$reseller[0]->bandwidth}}</x-slot> <x-slot name="value">{{$reseller->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">
@ -214,7 +214,7 @@
<x-slot name="value">1</x-slot> <x-slot name="value">1</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">{{$reseller[0]->ftp_limit}}</x-slot> <x-slot name="value">{{$reseller->ftp_limit}}</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">
@ -224,17 +224,17 @@
<x-slot name="value">1</x-slot> <x-slot name="value">1</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">{{$reseller[0]->db_limit}}</x-slot> <x-slot name="value">{{$reseller->db_limit}}</x-slot>
</x-number-input> </x-number-input>
</div> </div>
</div> </div>
<div class="row mb-3"> <div class="row">
<div class="col-12 col-lg-3 mb-4"> <div class="col-12 col-lg-3 mb-4">
<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($reseller->labels[0]->label->id))
<x-slot name="current">{{$labels[0]->id}}</x-slot> <x-slot name="current">{{$reseller->labels[0]->label->id}}</x-slot>
@endif @endif
</x-labels-select> </x-labels-select>
</div> </div>
@ -242,8 +242,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($reseller->labels[1]->label->id))
<x-slot name="current">{{$labels[1]->id}}</x-slot> <x-slot name="current">{{$reseller->labels[1]->label->id}}</x-slot>
@endif @endif
</x-labels-select> </x-labels-select>
</div> </div>
@ -251,8 +251,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($reseller->labels[2]->label->id))
<x-slot name="current">{{$labels[2]->id}}</x-slot> <x-slot name="current">{{$reseller->labels[2]->label->id}}</x-slot>
@endif @endif
</x-labels-select> </x-labels-select>
</div> </div>
@ -260,15 +260,15 @@
<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($reseller->labels[3]->label->id))
<x-slot name="current">{{$labels[3]->id}}</x-slot> <x-slot name="current">{{$reseller->labels[3]->label->id}}</x-slot>
@endif @endif
</x-labels-select> </x-labels-select>
</div> </div>
</div> </div>
<div class="form-check mt-2"> <div class="form-check mt-2">
<input class="form-check-input" name="is_active" type="checkbox" <input class="form-check-input" name="is_active" type="checkbox"
value="1" {{ ($reseller[0]->active === 1) ? 'checked' : '' }}> value="1" {{ ($reseller->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>

View File

@ -44,20 +44,20 @@
<td>{{ $row->main_domain }}</td> <td>{{ $row->main_domain }}</td>
<td>{{ $row->reseller_type }}</td> <td>{{ $row->reseller_type }}</td>
<td>{{ $row->accounts }}</td> <td>{{ $row->accounts }}</td>
<td class="text-nowrap">{{ $row->location }}</td> <td class="text-nowrap">{{ $row->location->name }}</td>
<td class="text-nowrap">{{ $row->provider_name }}</td> <td class="text-nowrap">{{ $row->provider->name }}</td>
<td>{{ $row->disk_as_gb }} <small>GB</small></td> <td>{{ $row->disk_as_gb }} <small>GB</small></td>
<td>{{ $row->price }} {{$row->currency}} {{\App\Process::paymentTermIntToString($row->term)}}</td> <td>{{ $row->price->price }} {{$row->price->currency}} {{\App\Process::paymentTermIntToString($row->price->term)}}</td>
<td>{{Carbon\Carbon::parse($row->next_due_date)->diffForHumans()}}</td> <td>{{Carbon\Carbon::parse($row->price->next_due_date)->diffForHumans()}}</td>
<td class="text-nowrap">{{ $row->owned_since }}</td> <td class="text-nowrap">{{ $row->owned_since }}</td>
<td class="text-nowrap"> <td class="text-nowrap">
<form action="{{ route('reseller.destroy', $row->service_id) }}" method="POST"> <form action="{{ route('reseller.destroy', $row->id) }}" method="POST">
<a href="{{ route('reseller.show', $row->service_id) }}" <a href="{{ route('reseller.show', $row->id) }}"
class="text-body mx-1"><i class="fas fa-eye" title="view"></i></a> class="text-body mx-1"><i class="fas fa-eye" title="view"></i></a>
<a href="{{ route('reseller.edit', $row->service_id) }}" <a href="{{ route('reseller.edit', $row->id) }}"
class="text-body mx-1"><i class="fas fa-pen" title="edit"></i></a> class="text-body mx-1"><i class="fas fa-pen" title="edit"></i></a>
<i class="fas fa-trash text-danger ms-3" @click="modalForm" <i class="fas fa-trash text-danger ms-3" @click="modalForm"
id="btn-{{$row->main_domain}}" title="{{$row->service_id}}"></i> id="btn-{{$row->main_domain}}" title="{{$row->id}}"></i>
</form> </form>
</td> </td>
</tr> </tr>

View File

@ -8,13 +8,9 @@
<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>{{ $reseller->main_domain }}</h2> <h2>{{ $reseller->main_domain }}</h2>
<code>@foreach($labels as $label) @foreach($reseller->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">{{ $reseller->id }}</h6> <h6 class="text-muted pe-lg-4">{{ $reseller->id }}</h6>
@ -30,7 +26,7 @@
<tbody> <tbody>
<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>{{ $reseller_extras[0]->reseller_type }}</td> <td>{{ $reseller->reseller_type }}</td>
</tr> </tr>
<tr> <tr>
<td class="px-2 py-2 font-bold text-muted">Main domain</td> <td class="px-2 py-2 font-bold text-muted">Main domain</td>
@ -39,22 +35,22 @@
</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>{{ $reseller_extras[0]->location }}</td> <td>{{ $reseller->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>{{ $reseller_extras[0]->provider_name }}</td> <td>{{ $reseller->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>{{ $reseller_extras[0]->price }} {{ $reseller_extras[0]->currency }} <td>{{ $reseller->price->price }} {{ $reseller->price->currency }}
<small>{{\App\Process::paymentTermIntToString($reseller_extras[0]->term)}}</small> <small>{{\App\Process::paymentTermIntToString($reseller->price->term)}}</small>
</td> </td>
</tr> </tr>
<tr> <tr>
<td class="px-2 py-2 font-bold text-muted">Has dedicated IP?</td> <td class="px-2 py-2 font-bold text-muted">Has dedicated IP?</td>
<td> <td>
@if(isset($ip_address[0]->address)) @if(isset($reseller->ips[0]->address))
Yes Yes
@else @else
No No
@ -63,8 +59,8 @@
</tr> </tr>
<tr> <tr>
<td class="px-2 py-2 font-bold text-muted">IP</td> <td class="px-2 py-2 font-bold text-muted">IP</td>
<td><code>@if(isset($ip_address[0]->address)) <td><code>@if(isset($reseller->ips[0]->address))
{{$ip_address[0]->address}} {{$reseller->ips[0]->address}}
@endif @endif
</code></td> </code></td>
</tr> </tr>
@ -78,8 +74,8 @@
</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($reseller_extras[0]->next_due_date)->diffForHumans()}} <td>{{Carbon\Carbon::parse($reseller->price->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)->format('d/m/Y')}})
</td> </td>
</tr> </tr>
<tr> <tr>
@ -142,14 +138,12 @@
</div> </div>
</div> </div>
<a href="{{ route('reseller.index') }}" <x-back-btn>
class="btn btn-success btn-sm mx-2"> <x-slot name="route">{{ route('reseller.index') }}</x-slot>
Go back </x-back-btn>
</a> <x-edit-btn>
<a href="{{ route('reseller.edit', $reseller->id) }}" <x-slot name="route">{{ route('reseller.edit', $reseller->id) }}</x-slot>
class="btn btn-primary btn-sm mx-2"> </x-edit-btn>
Edit
</a>
</x-card> </x-card>
@if(Session::has('timer_version_footer') && Session::get('timer_version_footer') === 1) @if(Session::has('timer_version_footer') && Session::get('timer_version_footer') === 1)
<p class="text-muted mt-4 text-end"><small> <p class="text-muted mt-4 text-end"><small>

View File

@ -1,7 +1,7 @@
@section('title') {{$seedbox[0]->title}} {{'edit'}} @endsection @section('title') {{$seedbox_data->title}} {{'edit'}} @endsection
<x-app-layout> <x-app-layout>
<x-slot name="header"> <x-slot name="header">
Edit {{ $seedbox[0]->title }} Edit {{ $seedbox_data->title }}
</x-slot> </x-slot>
<div class="container"> <div class="container">
<div class="card mt-3 shadow"> <div class="card mt-3 shadow">
@ -11,7 +11,7 @@
Back to seed boxes Back to seed boxes
</a> </a>
<x-auth-validation-errors></x-auth-validation-errors> <x-auth-validation-errors></x-auth-validation-errors>
<form action="{{ route('seedboxes.update', $seedbox[0]->service_id) }}" method="POST"> <form action="{{ route('seedboxes.update', $seedbox_data->id) }}" method="POST">
@csrf @csrf
@method('PUT') @method('PUT')
<div class="row mt-3"> <div class="row mt-3">
@ -20,7 +20,7 @@
<div class="input-group-prepend"><span class="input-group-text">Title</span></div> <div class="input-group-prepend"><span class="input-group-text">Title</span></div>
<input type="text" <input type="text"
class="form-control" class="form-control"
name="title" value="{{$seedbox[0]->title}}"> name="title" value="{{$seedbox_data->title}}">
@error('title') <span class="text-red-500">{{ $message }} @error('title') <span class="text-red-500">{{ $message }}
</span>@enderror </span>@enderror
</div> </div>
@ -30,44 +30,44 @@
<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" value="{{$seedbox[0]->hostname}}"> name="hostname" value="{{$seedbox_data->hostname}}">
</div> </div>
</div> </div>
<div class="col-12 col-lg-4 mb-4"> <div class="col-12 col-lg-4 mb-4">
<input type="hidden" name="id" value="{{$seedbox[0]->service_id}}"> <input type="hidden" name="id" value="{{$seedbox_data->id}}">
<div class="input-group"> <div class="input-group">
<div class="input-group-prepend"><span class="input-group-text">Type</span></div> <div class="input-group-prepend"><span class="input-group-text">Type</span></div>
<select class="form-control" name="seed_box_type"> <select class="form-control" name="seed_box_type">
<option <option
value="uTorrent" {{ ($seedbox[0]->seed_box_type === 'uTorrent') ? 'selected' : '' }}> value="uTorrent" {{ ($seedbox_data->seed_box_type === 'uTorrent') ? 'selected' : '' }}>
uTorrent uTorrent
</option> </option>
<option <option
value="BitTorrent" {{ ($seedbox[0]->seed_box_type === 'BitTorrent') ? 'selected' : '' }}> value="BitTorrent" {{ ($seedbox_data->seed_box_type === 'BitTorrent') ? 'selected' : '' }}>
BitTorrent BitTorrent
</option> </option>
<option <option
value="ruTorrent" {{ ($seedbox[0]->seed_box_type === 'ruTorrent') ? 'selected' : '' }}> value="ruTorrent" {{ ($seedbox_data->seed_box_type === 'ruTorrent') ? 'selected' : '' }}>
ruTorrent ruTorrent
</option> </option>
<option <option
value="Transmission" {{ ($seedbox[0]->seed_box_type === 'Transmission') ? 'selected' : '' }}> value="Transmission" {{ ($seedbox_data->seed_box_type === 'Transmission') ? 'selected' : '' }}>
Transmission Transmission
</option> </option>
<option <option
value="qBitTorrent" {{ ($seedbox[0]->seed_box_type === 'qBitTorrent') ? 'selected' : '' }}> value="qBitTorrent" {{ ($seedbox_data->seed_box_type === 'qBitTorrent') ? 'selected' : '' }}>
qBitTorrent qBitTorrent
</option> </option>
<option <option
value="Zona" {{ ($seedbox[0]->seed_box_type === 'Zona') ? 'selected' : '' }}> value="Zona" {{ ($seedbox_data->seed_box_type === 'Zona') ? 'selected' : '' }}>
Zona Zona
</option> </option>
<option <option
value="Other" {{ ($seedbox[0]->seed_box_type === 'Other') ? 'selected' : '' }}> value="Other" {{ ($seedbox_data->seed_box_type === 'Other') ? 'selected' : '' }}>
Other Other
</option> </option>
<option <option
value="Deluge" {{ ($seedbox[0]->seed_box_type === 'Deluge') ? 'selected' : '' }}> value="Deluge" {{ ($seedbox_data->seed_box_type === 'Deluge') ? 'selected' : '' }}>
Deluge Deluge
</option> </option>
</select> </select>
@ -77,14 +77,14 @@
<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">{{$seedbox[0]->provider_id}}</x-slot> <x-slot name="current">{{$seedbox_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">{{$seedbox[0]->price}}</x-slot> <x-slot name="value">{{$seedbox_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>
@ -92,40 +92,40 @@
</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">{{$seedbox[0]->term}}</x-slot> <x-slot name="current">{{$seedbox_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">{{$seedbox[0]->currency}}</x-slot> <x-slot name="current">{{$seedbox_data->price->currency}}</x-slot>
</x-currency-select> </x-currency-select>
</div> </div>
</div> </div>
<div class="row mb-2"> <div class="row mb-2">
<div class="col-12 col-md-3 mb-3"> <div class="col-12 col-md-3 mb-3">
<x-locations-select> <x-locations-select>
<x-slot name="current">{{$seedbox[0]->location_id}}</x-slot> <x-slot name="current">{{$seedbox_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-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">{{ $seedbox[0]->was_promo }}</x-slot> <x-slot name="value">{{ $seedbox_data->was_promo }}</x-slot>
</x-yes-no-select> </x-yes-no-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">{{$seedbox[0]->owned_since }}</x-slot> <x-slot name="value">{{$seedbox_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">{{$seedbox[0]->next_due_date }}</x-slot> <x-slot name="value">{{$seedbox_data->price->next_due_date }}</x-slot>
</x-date-input> </x-date-input>
</div> </div>
</div> </div>
@ -137,7 +137,7 @@
<x-slot name="value">1</x-slot> <x-slot name="value">1</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">{{$seedbox[0]->disk_as_gb}}</x-slot> <x-slot name="value">{{$seedbox_data->disk_as_gb}}</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">
@ -147,7 +147,7 @@
<x-slot name="value">1</x-slot> <x-slot name="value">1</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">{{$seedbox[0]->bandwidth}}</x-slot> <x-slot name="value">{{$seedbox_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">
@ -157,7 +157,7 @@
<x-slot name="value">1</x-slot> <x-slot name="value">1</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">{{$seedbox[0]->port_speed}}</x-slot> <x-slot name="value">{{$seedbox_data->port_speed}}</x-slot>
</x-number-input> </x-number-input>
</div> </div>
</div> </div>
@ -166,8 +166,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($seedbox_data->labels[0]->label->id))
<x-slot name="current">{{$labels[0]->id}}</x-slot> <x-slot name="current">{{$seedbox_data->labels[0]->label->id}}</x-slot>
@endif @endif
</x-labels-select> </x-labels-select>
</div> </div>
@ -175,8 +175,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($seedbox_data->labels[1]->label->id))
<x-slot name="current">{{$labels[1]->id}}</x-slot> <x-slot name="current">{{$seedbox_data->labels[1]->label->id}}</x-slot>
@endif @endif
</x-labels-select> </x-labels-select>
</div> </div>
@ -184,8 +184,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($seedbox_data->labels[2]->label->id))
<x-slot name="current">{{$labels[2]->id}}</x-slot> <x-slot name="current">{{$seedbox_data->labels[2]->label->id}}</x-slot>
@endif @endif
</x-labels-select> </x-labels-select>
</div> </div>
@ -193,15 +193,15 @@
<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($seedbox_data->labels[3]->label->id))
<x-slot name="current">{{$labels[3]->id}}</x-slot> <x-slot name="current">{{$seedbox_data->labels[3]->label->id}}</x-slot>
@endif @endif
</x-labels-select> </x-labels-select>
</div> </div>
</div> </div>
<div class="form-check mt-2"> <div class="form-check mt-2">
<input class="form-check-input" name="is_active" type="checkbox" <input class="form-check-input" name="is_active" type="checkbox"
value="1" {{ ($seedbox[0]->active === 1) ? 'checked' : '' }}> value="1" {{ ($seedbox_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>

View File

@ -43,8 +43,8 @@
<tr> <tr>
<td>{{ $row->title }}</td> <td>{{ $row->title }}</td>
<td>{{ $row->seed_box_type }}</td> <td>{{ $row->seed_box_type }}</td>
<td class="text-nowrap">{{ $row->location }}</td> <td class="text-nowrap">{{ $row->location->name }}</td>
<td class="text-nowrap">{{ $row->provider_name }}</td> <td class="text-nowrap">{{ $row->provider->name }}</td>
<td> <td>
@if($row->disk_as_gb >= 1000) @if($row->disk_as_gb >= 1000)
{{ number_format($row->disk_as_gb / 1000,1) }} <small>TB</small> {{ number_format($row->disk_as_gb / 1000,1) }} <small>TB</small>
@ -66,22 +66,22 @@
{{ $row->port_speed }} <small>Mbps</small> {{ $row->port_speed }} <small>Mbps</small>
@endif @endif
</td> </td>
<td>{{ $row->price }} {{$row->currency}} {{\App\Process::paymentTermIntToString($row->term)}}</td> <td>{{ $row->price->price }} {{$row->price->currency}} {{\App\Process::paymentTermIntToString($row->price->term)}}</td>
<td>{{Carbon\Carbon::parse($row->next_due_date)->diffForHumans()}}</td> <td>{{Carbon\Carbon::parse($row->price->next_due_date)->diffForHumans()}}</td>
<td class="text-nowrap">{{ $row->owned_since }}</td> <td class="text-nowrap">{{ $row->owned_since }}</td>
<td class="text-nowrap"> <td class="text-nowrap">
<form action="{{ route('seedboxes.destroy', $row->service_id) }}" method="POST"> <form action="{{ route('seedboxes.destroy', $row->id) }}" method="POST">
@csrf @csrf
<a href="{{ route('seedboxes.show', $row->service_id) }}" <a href="{{ route('seedboxes.show', $row->id) }}"
class="text-body mx-1"> class="text-body mx-1">
<i class="fas fa-eye" title="view"></i> <i class="fas fa-eye" title="view"></i>
</a> </a>
<a href="{{ route('seedboxes.edit', $row->service_id) }}" <a href="{{ route('seedboxes.edit', $row->id) }}"
class="text-body mx-1"> class="text-body mx-1">
<i class="fas fa-pen" title="edit"></i> <i class="fas fa-pen" title="edit"></i>
</a> </a>
<i class="fas fa-trash text-danger ms-3" @click="modalForm" <i class="fas fa-trash text-danger ms-3" @click="modalForm"
id="btn-{{$row->title}}" title="{{$row->service_id}}"></i> id="btn-{{$row->title}}" title="{{$row->id}}"></i>
</form> </form>
</td> </td>
</tr> </tr>

View File

@ -1,4 +1,4 @@
@section('title') {{$seedbox->title}} {{'Seed box'}} @endsection @section('title') {{$seedbox_data->title}} {{'Seed box'}} @endsection
<x-app-layout> <x-app-layout>
<x-slot name="header"> <x-slot name="header">
{{ __('Seed box details') }} {{ __('Seed box details') }}
@ -7,18 +7,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>{{ $seedbox->title }}</h2> <h2>{{ $seedbox_data->title }}</h2>
<code>@foreach($labels as $label) @foreach($seedbox_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">{{ $seedbox->id }}</h6> <h6 class="text-muted pe-lg-4">{{ $seedbox_data->id }}</h6>
@if($seedbox->active !== 1) @if($seedbox_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>
@ -30,57 +26,57 @@
<tbody> <tbody>
<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>{{ $seedbox->seed_box_type }}</td> <td>{{ $seedbox_data->seed_box_type }}</td>
</tr> </tr>
<tr> <tr>
<td class="px-2 py-2 font-bold text-muted">Hostname</td> <td class="px-2 py-2 font-bold text-muted">Hostname</td>
<td><code>{{ $seedbox_extras[0]->hostname }}</code></td> <td><code>{{ $seedbox_data->hostname }}</code></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>{{ $seedbox_extras[0]->location }}</td> <td>{{ $seedbox_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>{{ $seedbox_extras[0]->provider_name }}</td> <td>{{ $seedbox_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>{{ $seedbox_extras[0]->price }} {{ $seedbox_extras[0]->currency }} <td>{{ $seedbox_data->price->price }} {{ $seedbox_data->price->currency }}
<small>{{\App\Process::paymentTermIntToString($seedbox_extras[0]->term)}}</small> <small>{{\App\Process::paymentTermIntToString($seedbox_data->price->term)}}</small>
</td> </td>
</tr> </tr>
<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>{{ ($seedbox_extras[0]->was_promo === 1) ? 'Yes' : 'No' }}</td> <td>{{ ($seedbox_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($seedbox->owned_since)) @if(!is_null($seedbox_data->owned_since))
{{ date_format(new DateTime($seedbox->owned_since), 'jS F Y') }} {{ date_format(new DateTime($seedbox_data->owned_since), 'jS F Y') }}
@endif @endif
</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($seedbox_extras[0]->next_due_date)->diffForHumans()}} <td>{{Carbon\Carbon::parse($seedbox_data->price->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)->format('d/m/Y')}})
</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($seedbox->created_at)) @if(!is_null($seedbox_data->created_at))
{{ date_format(new DateTime($seedbox->created_at), 'jS M y g:i a') }} {{ date_format(new DateTime($seedbox_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($seedbox->updated_at)) @if(!is_null($seedbox_data->updated_at))
{{ date_format(new DateTime($seedbox->updated_at), 'jS M y g:i a') }} {{ date_format(new DateTime($seedbox_data->updated_at), 'jS M y g:i a') }}
@endif @endif
</td> </td>
</tr> </tr>
@ -94,30 +90,30 @@
<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($seedbox->disk_as_gb >= 1000) @if($seedbox_data->disk_as_gb >= 1000)
{{ number_format($seedbox->disk_as_gb / 1000,1) }} <small>TB</small> {{ number_format($seedbox_data->disk_as_gb / 1000,1) }} <small>TB</small>
@else @else
{{ $seedbox->disk_as_gb }} <small>GB</small> {{ $seedbox_data->disk_as_gb }} <small>GB</small>
@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> <td>
@if($seedbox->bandwidth >= 1000) @if($seedbox_data->bandwidth >= 1000)
{{ number_format($seedbox->bandwidth / 1000,1) }} <small>TB</small> {{ number_format($seedbox_data->bandwidth / 1000,1) }} <small>TB</small>
@else @else
{{ $seedbox->bandwidth }} <small>GB</small> {{ $seedbox_data->bandwidth }} <small>GB</small>
@endif @endif
</td> </td>
</tr> </tr>
<tr> <tr>
<td class="px-2 py-2 font-bold text-muted">Port speed</td> <td class="px-2 py-2 font-bold text-muted">Port speed</td>
<td> <td>
@if($seedbox->port_speed >= 1000) @if($seedbox_data->port_speed >= 1000)
{{ number_format($seedbox->port_speed / 1000,1) }} <small>Gbps</small> {{ number_format($seedbox_data->port_speed / 1000,1) }} <small>Gbps</small>
@else @else
{{ $seedbox->port_speed }} <small>Mbps</small> {{ $seedbox_data->port_speed }} <small>Mbps</small>
@endif @endif
</td> </td>
</tr> </tr>
@ -126,14 +122,12 @@
</div> </div>
</div> </div>
<a href="{{ route('seedboxes.index') }}" <x-back-btn>
class="btn btn-success btn-sm mx-2"> <x-slot name="route">{{ route('seedboxes.index') }}</x-slot>
Go back </x-back-btn>
</a> <x-edit-btn>
<a href="{{ route('seedboxes.edit', $seedbox->id) }}" <x-slot name="route">{{ route('seedboxes.edit', $seedbox_data->id) }}</x-slot>
class="btn btn-primary btn-sm mx-2"> </x-edit-btn>
Edit
</a>
</x-card> </x-card>
@if(Session::has('timer_version_footer') && Session::get('timer_version_footer') === 1) @if(Session::has('timer_version_footer') && Session::get('timer_version_footer') === 1)
<p class="text-muted mt-4 text-end"><small> <p class="text-muted mt-4 text-end"><small>

View File

@ -0,0 +1,149 @@
@section('title')
{{'Servers'}}
@endsection
@section('style')
<x-modal-style></x-modal-style>
@endsection
@section('scripts')
<script src="{{ asset('js/vue.min.js') }}"></script>
<script src="{{ asset('js/axios.min.js') }}"></script>
@endsection
<x-app-layout>
<x-slot name="header">
{{ __('Servers') }}
</x-slot>
<div class="container" id="app">
<x-delete-confirm-modal></x-delete-confirm-modal>
<ul class="nav nav-tabs mt-3" id="myTab" role="tablist">
<li class="nav-item" role="presentation">
<button class="nav-link active" id="home-tab" data-bs-toggle="tab" data-bs-target="#home" type="button"
role="tab" aria-controls="home" aria-selected="true">Active
</button>
</li>
<li class="nav-item" role="presentation">
<button class="nav-link @if(!isset($non_active_servers[0]))disabled @endif" id="profile-tab"
data-bs-toggle="tab" data-bs-target="#non-active" type="button" role="tab"
aria-controls="profile" aria-selected="false">Non active
</button>
</li>
</ul>
<div class="tab-content" id="myTabContent">
<div class="tab-pane fade show active" id="home" role="tabpanel" aria-labelledby="home-tab">
<div class="row mt-3">
@if(!empty($servers))
@foreach($servers as $server)
<div class="col-12 col-lg-4 mb-2">
<div class="card rounded h-100" style="overflow-y: scroll">
<div class="card-body">
<div class="row">
<div class="col-12 col-lg-8">
<h5 class="card-title">{{ $server->hostname }}</h5>
</div>
<div class="col-12 col-lg-4 text-end">
<a href="{{route('servers.edit', $server->id)}}" style="color: #636363;"><i
class="fas fa-pen mx-1"></i></a>
<a href="{{route('servers.show', $server->id)}}" style="color: #636363;"><i
class="fas fa-eye mx-1"></i></a>
<a href="{{route('servers.show', $server->id)}}" style="color: #636363;"><i
class="fas fa-trash mx-1"></i></a>
</div>
</div>
<div class="row mt-1">
<div class="col-12 col-lg-8">
<h6 class="card-subtitle mb-2 text-muted">{{ $server->location->name }}</h6>
</div>
<div class="col-12 col-lg-4 text-lg-end">
<h6 class="card-subtitle mb-2 text-muted">{{ $server->price->currency }} {{ $server->price->price }}</h6>
</div>
</div>
<div class="row mt-1">
<div class="col-12 col-md-8">
<p class="card-text">{{ $server->provider->name }}</p>
</div>
<div class="col-12 col-md-4 text-md-end">
<p class="card-text">{{ $server->os->name }}</p>
</div>
</div>
<div class="row my-1">
<div class="col-6">
{{$server->cpu}}
<i class="fas fa-microchip mx-1" style="color: #0000008c;"></i>
</div>
<div class="col-6 text-end">
{{$server->ram}} {{$server->ram_type}}
<i class="fas fa-memory mx-1" style="color: #0000008c;"></i>
</div>
</div>
<div class="row my-1">
<div class="col-6">
{{$server->disk}} {{$server->disk_type}}
<i class="fas fa-hdd mx-1" style="color: #0000008c;"></i>
</div>
<div class="col-6 text-end">
@if(isset($server->yabs[0]->cpu_cores))
<i class="fas fa-check mx-1" style="color: #0000008c;"></i>YABs
@else
<i class="fas fa-times mx-1" style="color: #0000008c;"></i>YABs
@endif
</div>
</div>
</div>
</div>
</div>
@endforeach
@endif
</div>
</div>
<div class="tab-pane fade" id="non-active" role="tabpanel" aria-labelledby="non-active-tab">
</div>
@if(Session::has('timer_version_footer') && Session::get('timer_version_footer') === 1)
<p class="text-muted mt-4 text-end"><small>Built on Laravel
v{{ Illuminate\Foundation\Application::VERSION }} (PHP v{{ PHP_VERSION }})</small></p>
@endif
</div>
<script>
axios.defaults.headers.common = {
'Content-Type': 'application/json',
'X-Requested-With': 'XMLHttpRequest',
'X-CSRF-TOKEN': document.querySelector('meta[name="csrf-token"]').getAttribute('content'),
'Accept': 'application/json',
};
let app = new Vue({
el: "#app",
data: {
"status": false,
"modal_hostname": '',
"modal_id": '',
"delete_form_action": '',
showModal: false
},
methods: {
onClk(event) {
var hostname = event.target.id.replace('btn-', '');
if (hostname) {
axios
.get('/api/online/' + event.target.id.replace('btn-', ''), {headers: {'Authorization': 'Bearer ' + document.querySelector('meta[name="api_token"]').getAttribute('content')}})
.then(response => (this.status = response.data.is_online))
.finally(() => {
if (this.status) {
event.target.className = "fas fa-plug text-success mx-1";
} else if (!this.status) {
event.target.className = "fas fa-plug text-danger mx-1";
}
});
}
},
modalForm(event) {
this.showModal = true;
this.modal_hostname = event.target.id.replace('btn-', '');
this.modal_id = event.target.title;
this.delete_form_action = 'servers/' + this.modal_id;
}
}
});
</script>
</x-app-layout>

View File

@ -129,14 +129,12 @@
</tbody> </tbody>
</table> </table>
</div> </div>
<a href="{{ route('servers.index') }}" <x-back-btn>
class="btn btn-success btn-sm mx-2"> <x-slot name="route">{{ route('servers.index') }}</x-slot>
Go back </x-back-btn>
</a> <x-edit-btn>
<a href="{{ route('servers.edit', $server_data->id) }}" <x-slot name="route">{{ route('servers.edit', $server_data->id) }}</x-slot>
class="btn btn-primary btn-sm mx-2"> </x-edit-btn>
Edit
</a>
</div> </div>
<div class="col-12 col-lg-6"> <div class="col-12 col-lg-6">
@if($server_data->has_yabs) @if($server_data->has_yabs)

View File

@ -107,6 +107,22 @@
</x-currency-select> </x-currency-select>
</div> </div>
</div> </div>
<div class="row mt-3">
<div class="col-12 col-md-6 mb-3">
<div class="input-group">
<div class="input-group-prepend"><span
class="input-group-text">Save YABs input to txt</span></div>
<select class="form-control" name="save_yabs_as_txt">
<option value="1" {{ ($setting[0]->save_yabs_as_txt === 1) ? 'selected' : '' }}>
Yes
</option>
<option value="0" {{ ($setting[0]->save_yabs_as_txt === 0) ? 'selected' : '' }}>
No
</option>
</select>
</div>
</div>
</div>
<p>Only if <i>Show servers to public</i> is <b>YES</b> do these apply:</p> <p>Only if <i>Show servers to public</i> is <b>YES</b> do these apply:</p>
<div class="row mt-3"> <div class="row mt-3">
<div class="col-12 col-md-6 mb-3"> <div class="col-12 col-md-6 mb-3">

View File

@ -1,7 +1,7 @@
@section('title') {{$shared[0]->main_domain}} {{'edit'}} @endsection @section('title') {{$shared->main_domain}} {{'edit'}} @endsection
<x-app-layout> <x-app-layout>
<x-slot name="header"> <x-slot name="header">
Edit {{ $shared[0]->main_domain }} Edit {{ $shared->main_domain }}
</x-slot> </x-slot>
<div class="container"> <div class="container">
@ -12,7 +12,7 @@
Back to shared hosting Back to shared hosting
</a> </a>
<x-auth-validation-errors></x-auth-validation-errors> <x-auth-validation-errors></x-auth-validation-errors>
<form action="{{ route('shared.update', $shared[0]->id) }}" method="POST"> <form action="{{ route('shared.update', $shared->id) }}" method="POST">
@csrf @csrf
@method('PUT') @method('PUT')
<div class="row mt-3"> <div class="row mt-3">
@ -21,55 +21,55 @@
<div class="input-group-prepend"><span class="input-group-text">Domain</span></div> <div class="input-group-prepend"><span class="input-group-text">Domain</span></div>
<input type="text" <input type="text"
class="form-control" class="form-control"
name="domain" value="{{$shared[0]->main_domain}}"> name="domain" value="{{$shared->main_domain}}">
@error('name') <span class="text-red-500">{{ $message }} @error('name') <span class="text-red-500">{{ $message }}
</span>@enderror </span>@enderror
</div> </div>
</div> </div>
<div class="col-12 col-lg-3 mb-4"> <div class="col-12 col-lg-3 mb-4">
<input type="hidden" name="id" value="{{$shared[0]->id}}"> <input type="hidden" name="id" value="{{$shared->id}}">
<div class="input-group"> <div class="input-group">
<div class="input-group-prepend"><span class="input-group-text">Type</span></div> <div class="input-group-prepend"><span class="input-group-text">Type</span></div>
<select class="form-control" id="shared_type" name="shared_type"> <select class="form-control" id="shared_type" name="shared_type">
<option <option
value="ApisCP" {{ ($shared[0]->shared_type === 'ApisCP') ? 'selected' : '' }}> value="ApisCP" {{ ($shared->shared_type === 'ApisCP') ? 'selected' : '' }}>
ApisCP ApisCP
</option> </option>
<option <option
value="Centos" {{ ($shared[0]->shared_type === 'Centos') ? 'selected' : '' }}> value="Centos" {{ ($shared->shared_type === 'Centos') ? 'selected' : '' }}>
Centos Centos
</option> </option>
<option <option
value="cPanel" {{ ($shared[0]->shared_type === 'cPanel') ? 'selected' : '' }}> value="cPanel" {{ ($shared->shared_type === 'cPanel') ? 'selected' : '' }}>
cPanel cPanel
</option> </option>
<option <option
value="Direct Admin" {{ ($shared[0]->shared_type === 'Direct Admin') ? 'selected' : '' }}> value="Direct Admin" {{ ($shared->shared_type === 'Direct Admin') ? 'selected' : '' }}>
Direct Admin Direct Admin
</option> </option>
<option <option
value="Webmin" {{ ($shared[0]->shared_type === 'Webmin') ? 'selected' : '' }}> value="Webmin" {{ ($shared->shared_type === 'Webmin') ? 'selected' : '' }}>
Webmin Webmin
</option> </option>
<option value="Moss" {{ ($shared[0]->shared_type === 'Moss') ? 'selected' : '' }}> <option value="Moss" {{ ($shared->shared_type === 'Moss') ? 'selected' : '' }}>
Moss Moss
</option> </option>
<option value="Other" {{ ($shared[0]->shared_type === 'Other') ? 'selected' : '' }}> <option value="Other" {{ ($shared->shared_type === 'Other') ? 'selected' : '' }}>
Other Other
</option> </option>
<option value="Plesk" {{ ($shared[0]->shared_type === 'Plesk') ? 'selected' : '' }}> <option value="Plesk" {{ ($shared->shared_type === 'Plesk') ? 'selected' : '' }}>
Plesk Plesk
</option> </option>
<option <option
value="Run cloud" {{ ($shared[0]->shared_type === 'Run cloud') ? 'selected' : '' }}> value="Run cloud" {{ ($shared->shared_type === 'Run cloud') ? 'selected' : '' }}>
Run cloud Run cloud
</option> </option>
<option <option
value="Vesta CP" {{ ($shared[0]->shared_type === 'Vesta CP') ? 'selected' : '' }}> value="Vesta CP" {{ ($shared->shared_type === 'Vesta CP') ? 'selected' : '' }}>
Vesta CP Vesta CP
</option> </option>
<option <option
value="Virtual min" {{ ($shared[0]->shared_type === 'Virtual min') ? 'selected' : '' }}> value="Virtual min" {{ ($shared->shared_type === 'Virtual min') ? 'selected' : '' }}>
Virtual min Virtual min
</option> </option>
</select> </select>
@ -80,21 +80,21 @@
<x-slot name="title">Dedicated IP</x-slot> <x-slot name="title">Dedicated IP</x-slot>
<x-slot name="name">dedicated_ip</x-slot> <x-slot name="name">dedicated_ip</x-slot>
<x-slot name="max">255</x-slot> <x-slot name="max">255</x-slot>
<x-slot name="value">@if(isset($shared[0]->ips[0]->address)) {{$shared[0]->ips[0]->address}}@endif</x-slot> <x-slot name="value">@if(isset($shared->ips[0]->address)) {{$shared->ips[0]->address}}@endif</x-slot>
</x-text-input> </x-text-input>
</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">{{$shared[0]->provider->id}}</x-slot> <x-slot name="current">{{$shared->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">{{$shared[0]->price->price}}</x-slot> <x-slot name="value">{{$shared->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>
@ -102,40 +102,40 @@
</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">{{$shared[0]->price->term}}</x-slot> <x-slot name="current">{{$shared->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">{{$shared[0]->price->currency}}</x-slot> <x-slot name="current">{{$shared->price->currency}}</x-slot>
</x-currency-select> </x-currency-select>
</div> </div>
</div> </div>
<div class="row mb-2"> <div class="row mb-2">
<div class="col-12 col-md-3 mb-3"> <div class="col-12 col-md-3 mb-3">
<x-locations-select> <x-locations-select>
<x-slot name="current">{{$shared[0]->location->id}}</x-slot> <x-slot name="current">{{$shared->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-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">{{ $shared[0]->was_promo }}</x-slot> <x-slot name="value">{{ $shared->was_promo }}</x-slot>
</x-yes-no-select> </x-yes-no-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">{{$shared[0]->owned_since }}</x-slot> <x-slot name="value">{{$shared->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">{{$shared[0]->price->next_due_date }}</x-slot> <x-slot name="value">{{$shared->price->next_due_date }}</x-slot>
</x-date-input> </x-date-input>
</div> </div>
</div> </div>
@ -148,7 +148,7 @@
<x-slot name="value">1</x-slot> <x-slot name="value">1</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">{{$shared[0]->domains_limit}}</x-slot> <x-slot name="value">{{$shared->domains_limit}}</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">
@ -158,7 +158,7 @@
<x-slot name="value">1</x-slot> <x-slot name="value">1</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">{{$shared[0]->subdomains_limit}}</x-slot> <x-slot name="value">{{$shared->subdomains_limit}}</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">
@ -168,7 +168,7 @@
<x-slot name="value">1</x-slot> <x-slot name="value">1</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">{{$shared[0]->disk_as_gb}}</x-slot> <x-slot name="value">{{$shared->disk_as_gb}}</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">
@ -178,7 +178,7 @@
<x-slot name="value">1</x-slot> <x-slot name="value">1</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">{{$shared[0]->email_limit}}</x-slot> <x-slot name="value">{{$shared->email_limit}}</x-slot>
</x-number-input> </x-number-input>
</div> </div>
</div> </div>
@ -190,7 +190,7 @@
<x-slot name="value">1</x-slot> <x-slot name="value">1</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">{{$shared[0]->bandwidth}}</x-slot> <x-slot name="value">{{$shared->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">
@ -200,7 +200,7 @@
<x-slot name="value">1</x-slot> <x-slot name="value">1</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">{{$shared[0]->ftp_limit}}</x-slot> <x-slot name="value">{{$shared->ftp_limit}}</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">
@ -210,7 +210,7 @@
<x-slot name="value">1</x-slot> <x-slot name="value">1</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">{{$shared[0]->db_limit}}</x-slot> <x-slot name="value">{{$shared->db_limit}}</x-slot>
</x-number-input> </x-number-input>
</div> </div>
</div> </div>
@ -219,8 +219,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($shared[0]->labels[0]->label->id)) @if(isset($shared->labels[0]->label->id))
<x-slot name="current">{{$shared[0]->labels[0]->label->id}}</x-slot> <x-slot name="current">{{$shared->labels[0]->label->id}}</x-slot>
@endif @endif
</x-labels-select> </x-labels-select>
</div> </div>
@ -228,8 +228,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($shared[0]->labels[1]->label->id)) @if(isset($shared->labels[1]->label->id))
<x-slot name="current">{{$shared[0]->labels[1]->label->id}}</x-slot> <x-slot name="current">{{$shared->labels[1]->label->id}}</x-slot>
@endif @endif
</x-labels-select> </x-labels-select>
</div> </div>
@ -237,8 +237,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($shared[0]->labels[2]->label->id)) @if(isset($shared->labels[2]->label->id))
<x-slot name="current">{{$shared[0]->labels[2]->label->id}}</x-slot> <x-slot name="current">{{$shared->labels[2]->label->id}}</x-slot>
@endif @endif
</x-labels-select> </x-labels-select>
</div> </div>
@ -246,15 +246,15 @@
<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($shared[0]->labels[3]->label->id)) @if(isset($shared->labels[3]->label->id))
<x-slot name="current">{{$shared[0]->labels[3]->label->id}}</x-slot> <x-slot name="current">{{$shared->labels[3]->label->id}}</x-slot>
@endif @endif
</x-labels-select> </x-labels-select>
</div> </div>
</div> </div>
<div class="form-check mt-2"> <div class="form-check mt-2">
<input class="form-check-input" name="is_active" type="checkbox" <input class="form-check-input" name="is_active" type="checkbox"
value="1" {{ ($shared[0]->active === 1) ? 'checked' : '' }}> value="1" {{ ($shared->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>

View File

@ -133,14 +133,12 @@
</div> </div>
</div> </div>
<a href="{{ route('shared.index') }}" <x-back-btn>
class="btn btn-success btn-sm mx-2"> <x-slot name="route">{{ route('shared.index') }}</x-slot>
Go back </x-back-btn>
</a> <x-edit-btn>
<a href="{{ route('shared.edit', $shared->id) }}" <x-slot name="route">{{ route('shared.edit', $shared->id) }}</x-slot>
class="btn btn-primary btn-sm mx-2"> </x-edit-btn>
Edit
</a>
</x-card> </x-card>
@if(Session::has('timer_version_footer') && Session::get('timer_version_footer') === 1) @if(Session::has('timer_version_footer') && Session::get('timer_version_footer') === 1)
<p class="text-muted mt-4 text-end"><small> <p class="text-muted mt-4 text-end"><small>

View File

@ -5,10 +5,9 @@
</x-slot> </x-slot>
<div class="container"> <div class="container">
<x-card class="shadow mt-3"> <x-card class="shadow mt-3">
<x-back-button> <x-back-btn>
<x-slot name="href">{{ route('yabs.index') }}</x-slot> <x-slot name="route">{{ route('yabs.index') }}</x-slot>
Go back </x-back-btn>
</x-back-button>
<div class="row"> <div class="row">
<div class="'col-12 col-lg-6"> <div class="'col-12 col-lg-6">
<div class="table-responsive"> <div class="table-responsive">
@ -18,6 +17,14 @@
<td class="px-4 py-2 font-bold">Server</td> <td class="px-4 py-2 font-bold">Server</td>
<td><a href="{{route('servers.show', ['server' => $yab[0]->server_id])}}" class="text-decoration-none">{{ $yab[0]->server->hostname }}</a></td> <td><a href="{{route('servers.show', ['server' => $yab[0]->server_id])}}" class="text-decoration-none">{{ $yab[0]->server->hostname }}</a></td>
</tr> </tr>
<tr>
<td class="px-4 py-2 font-bold">Uptime</td>
<td>{{ $yab[0]->uptime }}</td>
</tr>
<tr>
<td class="px-4 py-2 font-bold">Distro</td>
<td>{{ $yab[0]->distro }}</td>
</tr>
<tr> <tr>
<td class="px-4 py-2 font-bold">CPU</td> <td class="px-4 py-2 font-bold">CPU</td>
<td>{{ $yab[0]->cpu_cores }} @ {{$yab[0]->cpu_freq}} Mhz</td> <td>{{ $yab[0]->cpu_cores }} @ {{$yab[0]->cpu_freq}} Mhz</td>
@ -30,6 +37,10 @@
<td class="px-4 py-2 font-bold">Ram</td> <td class="px-4 py-2 font-bold">Ram</td>
<td>{{ $yab[0]->ram }} {{$yab[0]->ram_type}}</td> <td>{{ $yab[0]->ram }} {{$yab[0]->ram_type}}</td>
</tr> </tr>
<tr>
<td class="px-4 py-2 font-bold">Swap</td>
<td>{{ $yab[0]->swap }} {{$yab[0]->swap_type}}</td>
</tr>
<tr> <tr>
<td class="px-4 py-2 font-bold">Disk</td> <td class="px-4 py-2 font-bold">Disk</td>
<td>{{ $yab[0]->disk }} {{$yab[0]->disk_type}}</td> <td>{{ $yab[0]->disk }} {{$yab[0]->disk_type}}</td>

View File

@ -70,6 +70,8 @@ Route::resource('shared', SharedController::class)->middleware(['auth']);
Route::resource('yabs', YabsController::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-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'); Route::get('yabs-compare/{yabs1}/{yabs2}', 'App\Http\Controllers\YabsController@compareYabs')->middleware(['auth'])->name('yabs.compare');