diff --git a/README.md b/README.md
index 751e3f7..cb38e62 100644
--- a/README.md
+++ b/README.md
@@ -8,7 +8,7 @@ Despite what the name infers this self hosted web app isn't just for storing idl
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.
-[](https://shields.io/) [](https://shields.io/) [](https://shields.io/) [](https://shields.io/)
+[](https://shields.io/) [](https://shields.io/) [](https://shields.io/) [](https://shields.io/)
@@ -20,7 +20,7 @@ GeekBench 5 scores to do easier comparing and sorting.
[Cloud Five Limited](https://cloud-v.net/) for providing the hosting for demo installation.
-## 2.1.7 changes (13th October 2022):
+## 2.1.8 changes (20th October 2022):
#### You can no longer use the form to submit YABS results
yabs.sh now has JSON formatted response and can POST the output directly from calling the script.
@@ -36,26 +36,18 @@ Example yabs.sh call to POST the result
#### Please run the following if updating from existing install:
```shell
-php artisan migrate
php artisan route:cache
php artisan cache:clear
```
-* Added default order by (Change this in settings)
-* Added dual success & error response alert component
-* Added new response alert component into views
-* Added input parameters for `compareYabs()`
-* Updated and fixed server_type and virt mix-ups
-* Updated views title `@section` layout
-* Updated cache timeframes
-* Updated `RouteServiceProvider::HOME` for `'/'`
-* Updated the server choose compare method
-* Fixed update server ssh port
-* Fixed server due in X days being null
-* Removed unused with 'labels.label' in queries
-* Removed unused welcome and dashboard views
-* Removed dashboard redirect to / from routes file
-* Removed now unused success & error alert components
+* Added & implemented details footer blade component
+* Added new index layout
+* Updated domains, misc, reseller, seedboxes and shared use new index layout
+* Updated validation for store and update
+* Updated `updatePricing()` to not need `$as_usd` parameter
+* Updated labels assigned insert
+* Updated order/sort by methods for pricing related columns
+* Removed add YABs button on servers index page
## Requires
diff --git a/app/Http/Controllers/DNSController.php b/app/Http/Controllers/DNSController.php
index d1de0d8..64d825e 100644
--- a/app/Http/Controllers/DNSController.php
+++ b/app/Http/Controllers/DNSController.php
@@ -34,9 +34,13 @@ class DNSController extends Controller
public function store(Request $request)
{
$request->validate([
- 'hostname' => 'required|min:2',
- 'address' => 'required|min:2',
- 'dns_type' => 'required'
+ 'hostname' => 'required|string|min:2',
+ 'address' => 'required|string|min:2',
+ 'dns_type' => 'required|string',
+ 'label1' => 'sometimes|nullable|string',
+ 'label2' => 'sometimes|nullable|string',
+ 'label3' => 'sometimes|nullable|string',
+ 'label4' => 'sometimes|nullable|string',
]);
$dns_id = Str::random(8);
@@ -90,9 +94,13 @@ class DNSController extends Controller
public function update(Request $request, DNS $dn)
{
$request->validate([
- 'hostname' => 'required|min:2',
- 'address' => 'required|min:2',
- 'dns_type' => 'required'
+ 'hostname' => 'required|string|min:2',
+ 'address' => 'required|string|min:2',
+ 'dns_type' => 'required|string',
+ 'label1' => 'sometimes|nullable|string',
+ 'label2' => 'sometimes|nullable|string',
+ 'label3' => 'sometimes|nullable|string',
+ 'label4' => 'sometimes|nullable|string',
]);
$dn->update([
diff --git a/app/Http/Controllers/DomainsController.php b/app/Http/Controllers/DomainsController.php
index 18dc838..bd15a6a 100644
--- a/app/Http/Controllers/DomainsController.php
+++ b/app/Http/Controllers/DomainsController.php
@@ -34,11 +34,20 @@ class DomainsController extends Controller
public function store(Request $request)
{
$request->validate([
- 'domain' => 'required|min:2',
- 'extension' => 'required|min:2',
- 'provider_id' => 'numeric',
+ 'domain' => 'required|string|min:2',
+ 'extension' => 'required|string|min:2',
+ 'ns1' => 'sometimes|nullable|min:2',
+ 'ns2' => 'sometimes|nullable|min:2',
+ 'ns3' => 'sometimes|nullable|min:2',
+ 'provider_id' => 'integer',
+ 'payment_term' => 'integer',
'price' => 'numeric',
- 'next_due_date' => 'required|date'
+ 'next_due_date' => 'required|date',
+ 'owned_since' => 'sometimes|nullable|date',
+ 'label1' => 'sometimes|nullable|string',
+ 'label2' => 'sometimes|nullable|string',
+ 'label3' => 'sometimes|nullable|string',
+ 'label4' => 'sometimes|nullable|string',
]);
$domain_id = Str::random(8);
@@ -74,15 +83,24 @@ class DomainsController extends Controller
public function update(Request $request, Domains $domain)
{
$request->validate([
- 'domain' => 'required|min:2',
- 'extension' => 'required|min:2',
- 'provider_id' => 'numeric',
- 'price' => 'numeric'
+ 'domain' => 'required|string|min:2',
+ 'extension' => 'required|string|min:2',
+ 'ns1' => 'sometimes|nullable|min:2',
+ 'ns2' => 'sometimes|nullable|min:2',
+ 'ns3' => 'sometimes|nullable|min:2',
+ 'provider_id' => 'integer',
+ 'payment_term' => 'integer',
+ 'price' => 'numeric',
+ 'next_due_date' => 'required|date',
+ 'owned_since' => 'sometimes|nullable|date',
+ 'label1' => 'sometimes|nullable|string',
+ 'label2' => 'sometimes|nullable|string',
+ 'label3' => 'sometimes|nullable|string',
+ 'label4' => 'sometimes|nullable|string',
]);
$pricing = new Pricing();
- $as_usd = $pricing->convertToUSD($request->price, $request->currency);
- $pricing->updatePricing($domain->id, $request->currency, $request->price, $request->payment_term, $as_usd, $request->next_due_date);
+ $pricing->updatePricing($domain->id, $request->currency, $request->price, $request->payment_term, $request->next_due_date);
$domain->update([
'domain' => $request->domain,
diff --git a/app/Http/Controllers/IPsController.php b/app/Http/Controllers/IPsController.php
index df3ef59..081174d 100644
--- a/app/Http/Controllers/IPsController.php
+++ b/app/Http/Controllers/IPsController.php
@@ -31,7 +31,8 @@ class IPsController extends Controller
{
$request->validate([
'address' => 'required|ip|min:2',
- 'ip_type' => 'required'
+ 'ip_type' => 'required|string|size:4',
+ 'service_id' => 'required|string'
]);
$ip_id = Str::random(8);
diff --git a/app/Http/Controllers/LabelsController.php b/app/Http/Controllers/LabelsController.php
index 7ff14a9..b5c269e 100644
--- a/app/Http/Controllers/LabelsController.php
+++ b/app/Http/Controllers/LabelsController.php
@@ -25,7 +25,7 @@ class LabelsController extends Controller
public function store(Request $request)
{
$request->validate([
- 'label' => 'required|min:2'
+ 'label' => 'required|string|min:2'
]);
Labels::create([
diff --git a/app/Http/Controllers/LocationsController.php b/app/Http/Controllers/LocationsController.php
index ace99cd..b007d3d 100644
--- a/app/Http/Controllers/LocationsController.php
+++ b/app/Http/Controllers/LocationsController.php
@@ -24,7 +24,7 @@ class LocationsController extends Controller
public function store(Request $request)
{
$request->validate([
- 'location_name' => 'required|min:2'
+ 'location_name' => 'required|string|min:2'
]);
Locations::create([
diff --git a/app/Http/Controllers/MiscController.php b/app/Http/Controllers/MiscController.php
index 92cacb8..f82a956 100644
--- a/app/Http/Controllers/MiscController.php
+++ b/app/Http/Controllers/MiscController.php
@@ -32,9 +32,11 @@ class MiscController extends Controller
public function store(Request $request)
{
$request->validate([
- 'name' => 'required|min:3',
+ 'name' => 'required|string|min:3',
'price' => 'required|numeric',
- 'owned_since' => 'date',
+ 'payment_term' => 'required|integer',
+ 'currency' => 'required|string|size:3',
+ 'owned_since' => 'sometimes|nullable|date',
'next_due_date' => 'required|date'
]);
@@ -65,21 +67,22 @@ class MiscController extends Controller
public function update(Request $request, Misc $misc)
{
$request->validate([
- 'name' => 'required',
- 'owned_since' => 'date',
+ 'name' => 'required|string|min:3',
+ 'price' => 'required|numeric',
+ 'payment_term' => 'required|integer',
+ 'currency' => 'required|string|size:3',
+ 'owned_since' => 'sometimes|nullable|date',
+ 'next_due_date' => 'required|date'
]);
- DB::table('misc_services')
- ->where('id', $misc->id)
- ->update([
- 'name' => $request->name,
- 'owned_since' => $request->owned_since,
- 'active' => (isset($request->is_active)) ? 1 : 0
- ]);
+ $misc->update([
+ 'name' => $request->name,
+ 'owned_since' => $request->owned_since,
+ 'active' => (isset($request->is_active)) ? 1 : 0
+ ]);
$pricing = new Pricing();
- $as_usd = $pricing->convertToUSD($request->price, $request->currency);
- $pricing->updatePricing($misc->id, $request->currency, $request->price, $request->payment_term, $as_usd, $request->next_due_date);
+ $pricing->updatePricing($misc->id, $request->currency, $request->price, $request->payment_term, $request->next_due_date);
Cache::forget("all_misc");
Cache::forget("misc.{$misc->id}");
diff --git a/app/Http/Controllers/OsController.php b/app/Http/Controllers/OsController.php
index 9a8b5e2..8cb5336 100644
--- a/app/Http/Controllers/OsController.php
+++ b/app/Http/Controllers/OsController.php
@@ -22,7 +22,7 @@ class OsController extends Controller
public function store(Request $request)
{
$request->validate([
- 'os_name' => 'required|min:2'
+ 'os_name' => 'required|string|min:2'
]);
OS::create([
diff --git a/app/Http/Controllers/ProvidersController.php b/app/Http/Controllers/ProvidersController.php
index 8e4eb89..cf1747d 100644
--- a/app/Http/Controllers/ProvidersController.php
+++ b/app/Http/Controllers/ProvidersController.php
@@ -24,7 +24,7 @@ class ProvidersController extends Controller
public function store(Request $request)
{
$request->validate([
- 'provider_name' => 'required|min:2'
+ 'provider_name' => 'required|string|min:2'
]);
Providers::create([
diff --git a/app/Http/Controllers/ResellerController.php b/app/Http/Controllers/ResellerController.php
index a6086a0..14a330c 100644
--- a/app/Http/Controllers/ResellerController.php
+++ b/app/Http/Controllers/ResellerController.php
@@ -31,26 +31,27 @@ class ResellerController extends Controller
{
$request->validate([
'domain' => 'required|min:4',
- 'reseller_type' => 'required',
- 'dedicated_ip' => 'present',
- 'accounts' => 'numeric',
- 'server_type' => 'numeric',
- 'ram' => 'numeric',
- 'disk' => 'numeric',
- 'os_id' => 'numeric',
- 'provider_id' => 'numeric',
- 'location_id' => 'numeric',
+ 'reseller_type' => 'required|string',
+ 'disk' => 'integer',
+ 'os_id' => 'integer',
+ 'provider_id' => 'integer',
+ 'location_id' => 'integer',
'price' => 'numeric',
- 'payment_term' => 'numeric',
- 'was_promo' => 'numeric',
- 'owned_since' => 'date',
- 'domains' => 'numeric',
- 'sub_domains' => 'numeric',
- 'bandwidth' => 'numeric',
- 'email' => 'numeric',
- 'ftp' => 'numeric',
- 'db' => 'numeric',
- 'next_due_date' => 'required|date'
+ 'payment_term' => 'integer',
+ 'was_promo' => 'integer',
+ 'owned_since' => 'sometimes|nullable|date',
+ 'accounts' => 'integer',
+ 'domains' => 'integer',
+ 'sub_domains' => 'integer',
+ 'bandwidth' => 'integer',
+ 'email' => 'integer',
+ 'ftp' => 'integer',
+ 'db' => 'integer',
+ 'next_due_date' => 'required|date',
+ 'label1' => 'sometimes|nullable|string',
+ 'label2' => 'sometimes|nullable|string',
+ 'label3' => 'sometimes|nullable|string',
+ 'label4' => 'sometimes|nullable|string',
]);
$reseller_id = Str::random(8);
@@ -106,50 +107,50 @@ class ResellerController extends Controller
public function update(Request $request, Reseller $reseller)
{
$request->validate([
- 'id' => 'required|size:8',
'domain' => 'required|min:4',
- 'reseller_type' => 'required',
- 'dedicated_ip' => 'present',
- 'server_type' => 'numeric',
- 'disk' => 'numeric',
- 'os_id' => 'numeric',
- 'provider_id' => 'numeric',
- 'location_id' => 'numeric',
+ 'reseller_type' => 'required|string',
+ 'disk' => 'integer',
+ 'os_id' => 'integer',
+ 'provider_id' => 'integer',
+ 'location_id' => 'integer',
'price' => 'numeric',
- 'payment_term' => 'numeric',
- 'was_promo' => 'numeric',
- 'owned_since' => 'date',
- 'domains' => 'numeric',
- 'sub_domains' => 'numeric',
- 'bandwidth' => 'numeric',
- 'email' => 'numeric',
- 'ftp' => 'numeric',
- 'db' => 'numeric'
+ 'payment_term' => 'integer',
+ 'was_promo' => 'integer',
+ 'owned_since' => 'sometimes|nullable|date',
+ 'accounts' => 'integer',
+ 'domains' => 'integer',
+ 'sub_domains' => 'integer',
+ 'bandwidth' => 'integer',
+ 'email' => 'integer',
+ 'ftp' => 'integer',
+ 'db' => 'integer',
+ 'next_due_date' => 'required|date',
+ 'label1' => 'sometimes|nullable|string',
+ 'label2' => 'sometimes|nullable|string',
+ 'label3' => 'sometimes|nullable|string',
+ 'label4' => 'sometimes|nullable|string',
]);
- DB::table('reseller_hosting')
- ->where('id', $request->id)
- ->update([
- 'main_domain' => $request->domain,
- 'reseller_type' => $request->reseller_type,
- 'provider_id' => $request->provider_id,
- 'location_id' => $request->location_id,
- 'disk' => $request->disk,
- 'disk_type' => 'GB',
- 'disk_as_gb' => $request->disk,
- 'owned_since' => $request->owned_since,
- 'bandwidth' => $request->bandwidth,
- 'was_promo' => $request->was_promo,
- 'domains_limit' => $request->domains,
- 'subdomains_limit' => $request->sub_domains,
- 'email_limit' => $request->email,
- 'ftp_limit' => $request->ftp,
- 'db_limit' => $request->db
- ]);
+ $reseller->update([
+ 'main_domain' => $request->domain,
+ 'reseller_type' => $request->reseller_type,
+ 'provider_id' => $request->provider_id,
+ 'location_id' => $request->location_id,
+ 'disk' => $request->disk,
+ 'disk_type' => 'GB',
+ 'disk_as_gb' => $request->disk,
+ 'owned_since' => $request->owned_since,
+ 'bandwidth' => $request->bandwidth,
+ 'was_promo' => $request->was_promo,
+ 'domains_limit' => $request->domains,
+ 'subdomains_limit' => $request->sub_domains,
+ 'email_limit' => $request->email,
+ 'ftp_limit' => $request->ftp,
+ 'db_limit' => $request->db
+ ]);
$pricing = new Pricing();
- $as_usd = $pricing->convertToUSD($request->price, $request->currency);
- $pricing->updatePricing($request->id, $request->currency, $request->price, $request->payment_term, $as_usd, $request->next_due_date);
+ $pricing->updatePricing($request->id, $request->currency, $request->price, $request->payment_term, $request->next_due_date);
Labels::deleteLabelsAssignedTo($request->id);
Labels::insertLabelsAssigned([$request->label1, $request->label2, $request->label3, $request->label4], $request->id);
diff --git a/app/Http/Controllers/SeedBoxesController.php b/app/Http/Controllers/SeedBoxesController.php
index 73c7109..39411fe 100644
--- a/app/Http/Controllers/SeedBoxesController.php
+++ b/app/Http/Controllers/SeedBoxesController.php
@@ -29,19 +29,23 @@ class SeedBoxesController extends Controller
public function store(Request $request)
{
$request->validate([
- 'title' => 'required|string',
- 'hostname' => 'string|nullable',
- 'seed_box_type' => 'required',
- 'provider_id' => 'numeric',
- 'location_id' => 'numeric',
+ 'title' => 'required|string|min:2',
+ 'hostname' => 'sometimes|nullable|string|min:2',
+ 'seed_box_type' => 'required|string',
+ 'provider_id' => 'integer',
+ 'location_id' => 'integer',
'price' => 'numeric',
- 'payment_term' => 'numeric',
- 'was_promo' => 'numeric',
- 'owned_since' => 'date',
- 'disk' => 'numeric',
- 'bandwidth' => 'numeric',
- 'port_speed' => 'numeric',
- 'next_due_date' => 'required|date'
+ 'payment_term' => 'integer',
+ 'was_promo' => 'integer',
+ 'owned_since' => 'sometimes|nullable|date',
+ 'disk' => 'integer',
+ 'bandwidth' => 'integer',
+ 'port_speed' => 'integer',
+ 'next_due_date' => 'required|date',
+ 'label1' => 'sometimes|nullable|string',
+ 'label2' => 'sometimes|nullable|string',
+ 'label3' => 'sometimes|nullable|string',
+ 'label4' => 'sometimes|nullable|string',
]);
$seedbox_id = Str::random(8);
@@ -91,41 +95,42 @@ class SeedBoxesController extends Controller
public function update(Request $request, SeedBoxes $seedbox)
{
$request->validate([
- 'id' => 'required|size:8',
- 'title' => 'required|string',
- 'hostname' => 'string|nullable',
- 'seed_box_type' => 'required',
- 'disk' => 'numeric',
- 'provider_id' => 'numeric',
- 'location_id' => 'numeric',
+ 'title' => 'required|string|min:2',
+ 'hostname' => 'sometimes|nullable|string|min:2',
+ 'seed_box_type' => 'required|string',
+ 'provider_id' => 'integer',
+ 'location_id' => 'integer',
'price' => 'numeric',
- 'payment_term' => 'numeric',
- 'was_promo' => 'numeric',
- 'owned_since' => 'date',
- 'bandwidth' => 'numeric',
- 'port_speed' => 'numeric'
+ 'payment_term' => 'integer',
+ 'was_promo' => 'integer',
+ 'owned_since' => 'sometimes|nullable|date',
+ 'disk' => 'integer',
+ 'bandwidth' => 'integer',
+ 'port_speed' => 'integer',
+ 'next_due_date' => 'required|date',
+ 'label1' => 'sometimes|nullable|string',
+ 'label2' => 'sometimes|nullable|string',
+ 'label3' => 'sometimes|nullable|string',
+ 'label4' => 'sometimes|nullable|string',
]);
- DB::table('seedboxes')
- ->where('id', $seedbox->id)
- ->update([
- 'title' => $request->title,
- 'hostname' => $request->hostname,
- 'seed_box_type' => $request->seed_box_type,
- 'location_id' => $request->location_id,
- 'provider_id' => $request->provider_id,
- 'disk' => $request->disk,
- 'disk_type' => 'GB',
- 'disk_as_gb' => $request->disk,
- 'owned_since' => $request->owned_since,
- 'bandwidth' => $request->bandwidth,
- 'port_speed' => $request->port_speed,
- 'was_promo' => $request->was_promo
- ]);
+ $seedbox->update([
+ 'title' => $request->title,
+ 'hostname' => $request->hostname,
+ 'seed_box_type' => $request->seed_box_type,
+ 'location_id' => $request->location_id,
+ 'provider_id' => $request->provider_id,
+ 'disk' => $request->disk,
+ 'disk_type' => 'GB',
+ 'disk_as_gb' => $request->disk,
+ 'owned_since' => $request->owned_since,
+ 'bandwidth' => $request->bandwidth,
+ 'port_speed' => $request->port_speed,
+ 'was_promo' => $request->was_promo
+ ]);
$pricing = new Pricing();
- $as_usd = $pricing->convertToUSD($request->price, $request->currency);
- $pricing->updatePricing($seedbox->id, $request->currency, $request->price, $request->payment_term, $as_usd, $request->next_due_date);
+ $pricing->updatePricing($seedbox->id, $request->currency, $request->price, $request->payment_term, $request->next_due_date);
Labels::deleteLabelsAssignedTo($seedbox->id);
Labels::insertLabelsAssigned([$request->label1, $request->label2, $request->label3, $request->label4], $seedbox->id);
diff --git a/app/Http/Controllers/ServerController.php b/app/Http/Controllers/ServerController.php
index 60fd171..03f9070 100644
--- a/app/Http/Controllers/ServerController.php
+++ b/app/Http/Controllers/ServerController.php
@@ -18,9 +18,7 @@ class ServerController extends Controller
public function index()
{
$servers = Server::allActiveServers();
-
$non_active_servers = Server::allNonActiveServers();
-
return view('servers.index', compact(['servers', 'non_active_servers']));
}
@@ -43,22 +41,30 @@ class ServerController extends Controller
public function store(Request $request)
{
-
$request->validate([
'hostname' => 'required|min:5',
- 'ip1' => 'nullable|ip',
- 'ip2' => 'nullable|ip',
- 'service_type' => 'numeric',
- 'server_type' => 'numeric',
- 'ram' => 'numeric',
- 'disk' => 'numeric',
- 'os_id' => 'numeric',
- 'provider_id' => 'numeric',
- 'location_id' => 'numeric',
- 'price' => 'numeric',
- 'cpu' => 'numeric',
- 'was_promo' => 'numeric',
- 'next_due_date' => 'required|date'
+ 'ip1' => 'sometimes|nullable|ip',
+ 'ip2' => 'sometimes|nullable|ip',
+ 'ns1' => 'sometimes|nullable|string',
+ 'ns2' => 'sometimes|nullable|string',
+ 'service_type' => 'integer',
+ 'server_type' => 'integer',
+ 'ssh_port' => 'integer',
+ 'bandwidth' => 'integer',
+ 'ram' => 'required|numeric',
+ 'disk' => 'required|integer',
+ 'os_id' => 'required|integer',
+ 'provider_id' => 'required|integer',
+ 'location_id' => 'required|integer',
+ 'price' => 'required|numeric',
+ 'cpu' => 'required|integer',
+ 'was_promo' => 'integer',
+ 'next_due_date' => 'required|date',
+ 'owned_since' => 'sometimes|nullable|date',
+ 'label1' => 'sometimes|nullable|string',
+ 'label2' => 'sometimes|nullable|string',
+ 'label3' => 'sometimes|nullable|string',
+ 'label4' => 'sometimes|nullable|string',
]);
$server_id = Str::random(8);
@@ -123,49 +129,57 @@ class ServerController extends Controller
{
$request->validate([
'hostname' => 'required|min:5',
- 'ram' => 'numeric',
- 'disk' => 'numeric',
- 'os_id' => 'numeric',
- 'provider_id' => 'numeric',
- 'location_id' => 'numeric',
- 'price' => 'numeric',
- 'cpu' => 'numeric',
- 'was_promo' => 'numeric',
- 'next_due_date' => 'date'
+ 'ip1' => 'sometimes|nullable|ip',
+ 'ip2' => 'sometimes|nullable|ip',
+ 'ns1' => 'sometimes|nullable|string',
+ 'ns2' => 'sometimes|nullable|string',
+ 'service_type' => 'integer',
+ 'server_type' => 'integer',
+ 'ssh_port' => 'integer',
+ 'bandwidth' => 'integer',
+ 'ram' => 'required|numeric',
+ 'disk' => 'required|integer',
+ 'os_id' => 'required|integer',
+ 'provider_id' => 'required|integer',
+ 'location_id' => 'required|integer',
+ 'price' => 'required|numeric',
+ 'cpu' => 'required|integer',
+ 'was_promo' => 'integer',
+ 'next_due_date' => 'required|date',
+ 'owned_since' => 'sometimes|nullable|date',
+ 'label1' => 'sometimes|nullable|string',
+ 'label2' => 'sometimes|nullable|string',
+ 'label3' => 'sometimes|nullable|string',
+ 'label4' => 'sometimes|nullable|string',
+ ]);
+
+ $server->update([
+ 'hostname' => $request->hostname,
+ 'server_type' => $request->server_type,
+ 'os_id' => $request->os_id,
+ 'ssh' => $request->ssh_port,
+ 'provider_id' => $request->provider_id,
+ 'location_id' => $request->location_id,
+ 'ram' => $request->ram,
+ 'ram_type' => $request->ram_type,
+ 'ram_as_mb' => ($request->ram_type === 'MB') ? $request->ram : ($request->ram * 1024),
+ 'disk' => $request->disk,
+ 'disk_type' => $request->disk_type,
+ 'disk_as_gb' => ($request->disk_type === 'GB') ? $request->disk : ($request->disk * 1024),
+ 'owned_since' => $request->owned_since,
+ 'ns1' => $request->ns1,
+ 'ns2' => $request->ns2,
+ 'bandwidth' => $request->bandwidth,
+ 'cpu' => $request->cpu,
+ 'was_promo' => $request->was_promo,
+ 'active' => (isset($request->is_active)) ? 1 : 0,
+ 'show_public' => (isset($request->show_public)) ? 1 : 0
]);
$server_id = $request->server_id;
- DB::table('servers')
- ->where('id', $server_id)
- ->update([
- 'hostname' => $request->hostname,
- 'server_type' => $request->server_type,
- 'os_id' => $request->os_id,
- 'ssh' => $request->ssh_port,
- 'provider_id' => $request->provider_id,
- 'location_id' => $request->location_id,
- 'ram' => $request->ram,
- 'ram_type' => $request->ram_type,
- 'ram_as_mb' => ($request->ram_type === 'MB') ? $request->ram : ($request->ram * 1024),
- 'disk' => $request->disk,
- 'disk_type' => $request->disk_type,
- 'disk_as_gb' => ($request->disk_type === 'GB') ? $request->disk : ($request->disk * 1024),
- 'owned_since' => $request->owned_since,
- 'ns1' => $request->ns1,
- 'ns2' => $request->ns2,
- 'bandwidth' => $request->bandwidth,
- 'cpu' => $request->cpu,
- 'was_promo' => $request->was_promo,
- 'active' => (isset($request->is_active)) ? 1 : 0,
- 'show_public' => (isset($request->show_public)) ? 1 : 0
- ]);
-
$pricing = new Pricing();
-
- $as_usd = $pricing->convertToUSD($request->price, $request->currency);
-
- $pricing->updatePricing($server_id, $request->currency, $request->price, $request->payment_term, $as_usd, $request->next_due_date);
+ $pricing->updatePricing($server_id, $request->currency, $request->price, $request->payment_term, $request->next_due_date);
Labels::deleteLabelsAssignedTo($server_id);
@@ -209,7 +223,7 @@ class ServerController extends Controller
{//NOTICE: Selecting servers is not cached yet
$all_servers = Server::where('has_yabs', 1)->get();
- if (isset($all_servers[1])){
+ if (isset($all_servers[1])) {
return view('servers.choose-compare', compact('all_servers'));
}
@@ -222,7 +236,7 @@ class ServerController extends Controller
$server1_data = Server::server($server1);
if (!isset($server1_data[0]->yabs[0])) {
- abort(404);
+ abort(404);
}
$server2_data = Server::server($server2);
diff --git a/app/Http/Controllers/SharedController.php b/app/Http/Controllers/SharedController.php
index b83e6f7..fb8aea4 100644
--- a/app/Http/Controllers/SharedController.php
+++ b/app/Http/Controllers/SharedController.php
@@ -29,24 +29,26 @@ class SharedController extends Controller
{
$request->validate([
'domain' => 'required|min:4',
- 'shared_type' => 'required',
- 'server_type' => 'numeric',
- 'ram' => 'numeric',
- 'disk' => 'numeric',
- 'os_id' => 'numeric',
- 'provider_id' => 'numeric',
- 'location_id' => 'numeric',
+ 'shared_type' => 'required|string',
+ 'disk' => 'integer',
+ 'os_id' => 'integer',
+ 'provider_id' => 'integer',
+ 'location_id' => 'integer',
'price' => 'numeric',
- 'payment_term' => 'numeric',
- 'was_promo' => 'numeric',
- 'owned_since' => 'date',
- 'domains' => 'numeric',
- 'sub_domains' => 'numeric',
- 'bandwidth' => 'numeric',
- 'email' => 'numeric',
- 'ftp' => 'numeric',
- 'db' => 'numeric',
- 'next_due_date' => 'required|date'
+ 'payment_term' => 'integer',
+ 'was_promo' => 'integer',
+ 'owned_since' => 'sometimes|nullable|date',
+ 'domains' => 'integer',
+ 'sub_domains' => 'integer',
+ 'bandwidth' => 'integer',
+ 'email' => 'integer',
+ 'ftp' => 'integer',
+ 'db' => 'integer',
+ 'next_due_date' => 'required|date',
+ 'label1' => 'sometimes|nullable|string',
+ 'label2' => 'sometimes|nullable|string',
+ 'label3' => 'sometimes|nullable|string',
+ 'label4' => 'sometimes|nullable|string',
]);
$shared_id = Str::random(8);
@@ -103,50 +105,49 @@ class SharedController extends Controller
public function update(Request $request, Shared $shared)
{
$request->validate([
- 'id' => 'required|size:8',
'domain' => 'required|min:4',
- 'shared_type' => 'required',
- 'dedicated_ip' => 'present',
- 'server_type' => 'numeric',
- 'disk' => 'numeric',
- 'os_id' => 'numeric',
- 'provider_id' => 'numeric',
- 'location_id' => 'numeric',
+ 'shared_type' => 'required|string',
+ 'disk' => 'integer',
+ 'os_id' => 'integer',
+ 'provider_id' => 'integer',
+ 'location_id' => 'integer',
'price' => 'numeric',
- 'payment_term' => 'numeric',
- 'was_promo' => 'numeric',
- 'owned_since' => 'date',
- 'domains' => 'numeric',
- 'sub_domains' => 'numeric',
- 'bandwidth' => 'numeric',
- 'email' => 'numeric',
- 'ftp' => 'numeric',
- 'db' => 'numeric'
+ 'payment_term' => 'integer',
+ 'was_promo' => 'integer',
+ 'owned_since' => 'sometimes|nullable|date',
+ 'domains' => 'integer',
+ 'sub_domains' => 'integer',
+ 'bandwidth' => 'integer',
+ 'email' => 'integer',
+ 'ftp' => 'integer',
+ 'db' => 'integer',
+ 'next_due_date' => 'required|date',
+ 'label1' => 'sometimes|nullable|string',
+ 'label2' => 'sometimes|nullable|string',
+ 'label3' => 'sometimes|nullable|string',
+ 'label4' => 'sometimes|nullable|string',
]);
- DB::table('shared_hosting')
- ->where('id', $request->id)
- ->update([
- 'main_domain' => $request->domain,
- 'shared_type' => $request->shared_type,
- 'provider_id' => $request->provider_id,
- 'location_id' => $request->location_id,
- 'disk' => $request->disk,
- 'disk_type' => 'GB',
- 'disk_as_gb' => $request->disk,
- 'owned_since' => $request->owned_since,
- 'bandwidth' => $request->bandwidth,
- 'was_promo' => $request->was_promo,
- 'domains_limit' => $request->domains,
- 'subdomains_limit' => $request->sub_domains,
- 'email_limit' => $request->email,
- 'ftp_limit' => $request->ftp,
- 'db_limit' => $request->db
- ]);
+ $shared->update([
+ 'main_domain' => $request->domain,
+ 'shared_type' => $request->shared_type,
+ 'provider_id' => $request->provider_id,
+ 'location_id' => $request->location_id,
+ 'disk' => $request->disk,
+ 'disk_type' => 'GB',
+ 'disk_as_gb' => $request->disk,
+ 'owned_since' => $request->owned_since,
+ 'bandwidth' => $request->bandwidth,
+ 'was_promo' => $request->was_promo,
+ 'domains_limit' => $request->domains,
+ 'subdomains_limit' => $request->sub_domains,
+ 'email_limit' => $request->email,
+ 'ftp_limit' => $request->ftp,
+ 'db_limit' => $request->db
+ ]);
$pricing = new Pricing();
- $as_usd = $pricing->convertToUSD($request->price, $request->currency);
- $pricing->updatePricing($request->id, $request->currency, $request->price, $request->payment_term, $as_usd, $request->next_due_date);
+ $pricing->updatePricing($request->id, $request->currency, $request->price, $request->payment_term, $request->next_due_date);
Labels::deleteLabelsAssignedTo($request->id);
Labels::insertLabelsAssigned([$request->label1, $request->label2, $request->label3, $request->label4], $request->id);
diff --git a/app/Models/Domains.php b/app/Models/Domains.php
index 0fd0150..5172992 100644
--- a/app/Models/Domains.php
+++ b/app/Models/Domains.php
@@ -6,6 +6,7 @@ use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\DB;
+use Illuminate\Support\Facades\Session;
class Domains extends Model
{
@@ -23,7 +24,12 @@ class Domains extends Model
public static function allDomains()
{//All domains and relationships (no using joins)
return Cache::remember("all_domains", now()->addMonth(1), function () {
- return Domains::with(['provider', 'price', 'labels'])->get();
+ $query = Domains::with(['provider', 'price', 'labels']);
+ if (in_array(Session::get('sort_on'), [3, 4, 5, 6], true)) {
+ $options = Settings::orderByProcess(Session::get('sort_on'));
+ $query->orderBy(Pricing::select("pricings.$options[0]")->whereColumn("pricings.service_id", "domains.id"), $options[1]);
+ }
+ return $query->get();
});
}
diff --git a/app/Models/Labels.php b/app/Models/Labels.php
index 0d8104a..0e98598 100644
--- a/app/Models/Labels.php
+++ b/app/Models/Labels.php
@@ -33,7 +33,7 @@ class Labels extends Model
{
for ($i = 1; $i <= 4; $i++) {
if (!is_null($labels_array[($i - 1)])) {
- DB::insert('INSERT INTO labels_assigned (label_id, service_id) values (?, ?)', [$labels_array[($i - 1)], $service_id]);
+ DB::table('labels_assigned')->insert(['label_id' => $labels_array[($i - 1)], 'service_id' => $service_id]);
}
}
}
diff --git a/app/Models/Misc.php b/app/Models/Misc.php
index 859c303..008b47c 100644
--- a/app/Models/Misc.php
+++ b/app/Models/Misc.php
@@ -35,7 +35,12 @@ class Misc extends Model
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();
+ $query = Misc::with(['price']);
+ if (in_array(Session::get('sort_on'), [3, 4, 5, 6], true)) {
+ $options = Settings::orderByProcess(Session::get('sort_on'));
+ $query->orderBy(Pricing::select("pricings.$options[0]")->whereColumn("pricings.service_id", "misc_services.id"), $options[1]);
+ }
+ return $query->get();
});
}
@@ -49,9 +54,6 @@ class Misc extends Model
public function price()
{
- if (in_array(Session::get('sort_on'), [3, 4, 5, 6], true)) {
- return $this->hasOne(Pricing::class, 'service_id', 'id')->orderBy(Settings::orderByProcess(Session::get('sort_on'))[0], Settings::orderByProcess(Session::get('sort_on'))[1]);
- }
return $this->hasOne(Pricing::class, 'service_id', 'id');
}
diff --git a/app/Models/Pricing.php b/app/Models/Pricing.php
index 867d9c3..254a89a 100644
--- a/app/Models/Pricing.php
+++ b/app/Models/Pricing.php
@@ -48,7 +48,7 @@ class Pricing extends Model
private static function getRates($currency): float
{
$rate = self::refreshRates()->$currency;
- return $rate === null ? 1.00 : $rate;
+ return $rate ?? 1.00;
}
public static function getCurrencyList(): array
@@ -125,8 +125,9 @@ class Pricing extends Model
]);
}
- public function updatePricing(string $service_id, string $currency, float $price, int $term, float $as_usd, string $next_due_date, int $is_active = 1): int
+ public function updatePricing(string $service_id, string $currency, float $price, int $term, string $next_due_date, int $is_active = 1): int
{
+ $as_usd = $this->convertToUSD($price, $currency);
return DB::table('pricings')
->where('service_id', $service_id)
->update([
@@ -136,15 +137,14 @@ class Pricing extends Model
'as_usd' => $as_usd,
'usd_per_month' => $this->costAsPerMonth($as_usd, $term),
'next_due_date' => $next_due_date,
- 'active' => ($is_active) ? 1 : 0
+ 'active' => $is_active
]);
}
public static function allPricing()
{
return Cache::remember('all_pricing', now()->addWeek(1), function () {
- return DB::table('pricings')
- ->get();
+ return Pricing::get();
});
}
diff --git a/app/Models/Reseller.php b/app/Models/Reseller.php
index 312e8c5..b6f31bd 100644
--- a/app/Models/Reseller.php
+++ b/app/Models/Reseller.php
@@ -36,7 +36,12 @@ class Reseller extends Model
public static function allResellerHosting()
{//All reseller hosting and relationships (no using joins)
return Cache::remember("all_reseller", now()->addMonth(1), function () {
- return Reseller::with(['location', 'provider', 'price', 'ips', 'labels'])->get();
+ $query = Reseller::with(['location', 'provider', 'price', 'ips', 'labels']);
+ if (in_array(Session::get('sort_on'), [3, 4, 5, 6], true)) {
+ $options = Settings::orderByProcess(Session::get('sort_on'));
+ $query->orderBy(Pricing::select("pricings.$options[0]")->whereColumn("pricings.service_id", "reseller_hosting.id"), $options[1]);
+ }
+ return $query->get();
});
}
@@ -65,9 +70,6 @@ class Reseller extends Model
public function price()
{
- if (in_array(Session::get('sort_on'), [3, 4, 5, 6], true)) {
- return $this->hasOne(Pricing::class, 'service_id', 'id')->orderBy(Settings::orderByProcess(Session::get('sort_on'))[0], Settings::orderByProcess(Session::get('sort_on'))[1]);
- }
return $this->hasOne(Pricing::class, 'service_id', 'id');
}
diff --git a/app/Models/SeedBoxes.php b/app/Models/SeedBoxes.php
index 3fe0d32..712de5b 100644
--- a/app/Models/SeedBoxes.php
+++ b/app/Models/SeedBoxes.php
@@ -36,7 +36,12 @@ class SeedBoxes extends Model
public static function allSeedboxes()
{//All seedboxes and relationships (no using joins)
return Cache::remember("all_seedboxes", now()->addMonth(1), function () {
- return SeedBoxes::with(['location', 'provider', 'price'])->get();
+ $query = SeedBoxes::with(['location', 'provider', 'price']);
+ if (in_array(Session::get('sort_on'), [3, 4, 5, 6], true)) {
+ $options = Settings::orderByProcess(Session::get('sort_on'));
+ $query->orderBy(Pricing::select("pricings.$options[0]")->whereColumn("pricings.service_id", "seedboxes.id"), $options[1]);
+ }
+ return $query->get();
});
}
@@ -60,9 +65,6 @@ class SeedBoxes extends Model
public function price()
{
- if (in_array(Session::get('sort_on'), [3, 4, 5, 6], true)) {
- return $this->hasOne(Pricing::class, 'service_id', 'id')->orderBy(Settings::orderByProcess(Session::get('sort_on'))[0], Settings::orderByProcess(Session::get('sort_on'))[1]);
- }
return $this->hasOne(Pricing::class, 'service_id', 'id');
}
diff --git a/app/Models/Server.php b/app/Models/Server.php
index f34357e..8925718 100644
--- a/app/Models/Server.php
+++ b/app/Models/Server.php
@@ -43,7 +43,12 @@ class Server extends Model
public static function allServers()
{//All servers and relationships (no using joins)
return Cache::remember("all_servers", now()->addMonth(1), function () {
- return Server::with(['location', 'provider', 'os', 'price', 'ips', 'yabs', 'yabs.disk_speed', 'yabs.network_speed', 'labels'])->get();
+ $query = Server::with(['location', 'provider', 'os', 'price', 'ips', 'yabs', 'yabs.disk_speed', 'yabs.network_speed', 'labels']);
+ if (in_array(Session::get('sort_on'), [3, 4, 5, 6], true)) {
+ $options = Settings::orderByProcess(Session::get('sort_on'));
+ $query->orderBy(Pricing::select("pricings.$options[0]")->whereColumn("pricings.service_id", "servers.id"), $options[1]);
+ }
+ return $query->get();
});
}
@@ -58,8 +63,13 @@ class Server extends Model
public static function allActiveServers()
{//All ACTIVE servers and relationships replaces activeServersDataIndexPage()
return Cache::remember("all_active_servers", now()->addMonth(1), function () {
- return Server::where('active', '=', 1)
- ->with(['location', 'provider', 'os', 'ips', 'yabs', 'yabs.disk_speed', 'yabs.network_speed', 'labels', 'price'])->get();
+ $query = Server::where('active', '=', 1)
+ ->with(['location', 'provider', 'os', 'ips', 'yabs', 'yabs.disk_speed', 'yabs.network_speed', 'labels', 'price']);
+ if (in_array(Session::get('sort_on'), [3, 4, 5, 6], true)) {
+ $options = Settings::orderByProcess(Session::get('sort_on'));
+ $query->orderBy(Pricing::select("pricings.$options[0]")->whereColumn("pricings.service_id", "servers.id"), $options[1]);
+ }
+ return $query->get();
});
}
@@ -216,9 +226,6 @@ class Server extends Model
public function price()
{
- if (in_array(Session::get('sort_on'), [3, 4, 5, 6], true)) {
- return $this->hasOne(Pricing::class, 'service_id', 'id')->orderBy(Settings::orderByProcess(Session::get('sort_on'))[0], Settings::orderByProcess(Session::get('sort_on'))[1]);
- }
return $this->hasOne(Pricing::class, 'service_id', 'id');
}
diff --git a/app/Models/Shared.php b/app/Models/Shared.php
index c5b116b..953e433 100644
--- a/app/Models/Shared.php
+++ b/app/Models/Shared.php
@@ -36,7 +36,12 @@ class Shared extends Model
public static function allSharedHosting()
{//All shared hosting and relationships (no using joins)
return Cache::remember("all_shared", now()->addMonth(1), function () {
- return Shared::with(['location', 'provider', 'price', 'ips', 'labels'])->get();
+ $query = Shared::with(['location', 'provider', 'price', 'ips', 'labels']);
+ if (in_array(Session::get('sort_on'), [3, 4, 5, 6], true)) {
+ $options = Settings::orderByProcess(Session::get('sort_on'));
+ $query->orderBy(Pricing::select("pricings.$options[0]")->whereColumn("pricings.service_id", "shared_hosting.id"), $options[1]);
+ }
+ return $query->get();
});
}
@@ -65,9 +70,6 @@ class Shared extends Model
public function price()
{
- if (in_array(Session::get('sort_on'), [3, 4, 5, 6], true)) {
- return $this->hasOne(Pricing::class, 'service_id', 'id')->orderBy(Settings::orderByProcess(Session::get('sort_on'))[0], Settings::orderByProcess(Session::get('sort_on'))[1]);
- }
return $this->hasOne(Pricing::class, 'service_id', 'id');
}
diff --git a/resources/views/account/index.blade.php b/resources/views/account/index.blade.php
index 4a25290..587e006 100644
--- a/resources/views/account/index.blade.php
+++ b/resources/views/account/index.blade.php
@@ -46,10 +46,6 @@
- @if(Session::has('timer_version_footer') && Session::get('timer_version_footer') === 1)
-
@if(isset($timer))@endif Built on - Laravel - v{{ Illuminate\Foundation\Application::VERSION }} (PHP v{{ PHP_VERSION }})
- @endif +Built on Laravel v{{ Illuminate\Foundation\Application::VERSION }} (PHP + v{{ PHP_VERSION }})
+@endif diff --git a/resources/views/components/modal-delete-script.blade.php b/resources/views/components/modal-delete-script.blade.php index e6558a0..b640f71 100644 --- a/resources/views/components/modal-delete-script.blade.php +++ b/resources/views/components/modal-delete-script.blade.php @@ -8,10 +8,10 @@ showModal: false }, methods: { - modalForm(event) { + confirmDeleteModal(event) { this.showModal = true; - this.modal_hostname = event.target.id.replace('btn-', ''); - this.modal_id = event.target.title; + this.modal_hostname = event.target.title; + this.modal_id = event.target.id; this.delete_form_action = '{{$uri}}/' + this.modal_id; } } diff --git a/resources/views/dns/index.blade.php b/resources/views/dns/index.blade.php index 565ee03..ce052a5 100644 --- a/resources/views/dns/index.blade.php +++ b/resources/views/dns/index.blade.php @@ -42,8 +42,8 @@ @csrf @method('DELETE') - + @@ -57,12 +57,7 @@ - @if(Session::has('timer_version_footer') && Session::get('timer_version_footer') === 1) -- Built on Laravel v{{ Illuminate\Foundation\Application::VERSION }} (PHP v{{ PHP_VERSION }} - ) -
- @endif +{{ $domain->domain }}.{{$domain->extension}} | + class="text-decoration-none">{{ $domain->domain }} + .{{$domain->extension}}{{ $domain->owned_since}} | {{ now()->diffInDays($domain->price->next_due_date) }} days | {{ $domain->provider->name}} | -{{ $domain->price->price }} {{$domain->price->currency}} | +{{ $domain->price->price }} + {{$domain->price->currency}} |
- Built on Laravel v{{ Illuminate\Foundation\Application::VERSION }} (PHP v{{ PHP_VERSION }} - ) -
- @endif +- Built on Laravel v{{ Illuminate\Foundation\Application::VERSION }} (PHP v{{ PHP_VERSION }} - ) -
- @endif +- Built on Laravel v{{ Illuminate\Foundation\Application::VERSION }} (PHP v{{ PHP_VERSION }} - ) -
- @endif +- Built on Laravel v{{ Illuminate\Foundation\Application::VERSION }} (PHP v{{ PHP_VERSION }} - ) -
- @endif +- Built on Laravel v{{ Illuminate\Foundation\Application::VERSION }} (PHP v{{ PHP_VERSION }} - ) -
- @endif +- Built on Laravel v{{ Illuminate\Foundation\Application::VERSION }} (PHP v{{ PHP_VERSION }} - ) -
- @endif +- Built on Laravel v{{ Illuminate\Foundation\Application::VERSION }} (PHP v{{ PHP_VERSION }} - ) -
- @endif +Built on Laravel - v{{ Illuminate\Foundation\Application::VERSION }} (PHP v{{ PHP_VERSION }})
- @endif +- Built on Laravel v{{ Illuminate\Foundation\Application::VERSION }} (PHP v{{ PHP_VERSION }} - ) -
- @endif +Built on Laravel - v{{ Illuminate\Foundation\Application::VERSION }} (PHP v{{ PHP_VERSION }})
- @endif +Built on Laravel - v{{ Illuminate\Foundation\Application::VERSION }} (PHP v{{ PHP_VERSION }})
- @endif +- Built on Laravel v{{ Illuminate\Foundation\Application::VERSION }} (PHP v{{ PHP_VERSION }} - ) -
- @endif +Built on Laravel - v{{ Illuminate\Foundation\Application::VERSION }} (PHP v{{ PHP_VERSION }})
- @endif +