Added/Updated validation on store and update
Added/Updated validation on store and update Updated update method in shared, server, seedboxes, reseller and misc
This commit is contained in:
parent
c45df61f10
commit
a649f1749e
|
@ -34,9 +34,13 @@ class DNSController extends Controller
|
||||||
public function store(Request $request)
|
public function store(Request $request)
|
||||||
{
|
{
|
||||||
$request->validate([
|
$request->validate([
|
||||||
'hostname' => 'required|min:2',
|
'hostname' => 'required|string|min:2',
|
||||||
'address' => 'required|min:2',
|
'address' => 'required|string|min:2',
|
||||||
'dns_type' => 'required'
|
'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);
|
$dns_id = Str::random(8);
|
||||||
|
@ -90,9 +94,13 @@ class DNSController extends Controller
|
||||||
public function update(Request $request, DNS $dn)
|
public function update(Request $request, DNS $dn)
|
||||||
{
|
{
|
||||||
$request->validate([
|
$request->validate([
|
||||||
'hostname' => 'required|min:2',
|
'hostname' => 'required|string|min:2',
|
||||||
'address' => 'required|min:2',
|
'address' => 'required|string|min:2',
|
||||||
'dns_type' => 'required'
|
'dns_type' => 'required|string',
|
||||||
|
'label1' => 'sometimes|nullable|string',
|
||||||
|
'label2' => 'sometimes|nullable|string',
|
||||||
|
'label3' => 'sometimes|nullable|string',
|
||||||
|
'label4' => 'sometimes|nullable|string',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$dn->update([
|
$dn->update([
|
||||||
|
|
|
@ -34,11 +34,20 @@ class DomainsController extends Controller
|
||||||
public function store(Request $request)
|
public function store(Request $request)
|
||||||
{
|
{
|
||||||
$request->validate([
|
$request->validate([
|
||||||
'domain' => 'required|min:2',
|
'domain' => 'required|string|min:2',
|
||||||
'extension' => 'required|min:2',
|
'extension' => 'required|string|min:2',
|
||||||
'provider_id' => 'numeric',
|
'ns1' => 'sometimes|nullable|min:2',
|
||||||
|
'ns2' => 'sometimes|nullable|min:2',
|
||||||
|
'ns3' => 'sometimes|nullable|min:2',
|
||||||
|
'provider_id' => 'integer',
|
||||||
|
'payment_term' => 'integer',
|
||||||
'price' => 'numeric',
|
'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);
|
$domain_id = Str::random(8);
|
||||||
|
@ -74,10 +83,20 @@ class DomainsController extends Controller
|
||||||
public function update(Request $request, Domains $domain)
|
public function update(Request $request, Domains $domain)
|
||||||
{
|
{
|
||||||
$request->validate([
|
$request->validate([
|
||||||
'domain' => 'required|min:2',
|
'domain' => 'required|string|min:2',
|
||||||
'extension' => 'required|min:2',
|
'extension' => 'required|string|min:2',
|
||||||
'provider_id' => 'numeric',
|
'ns1' => 'sometimes|nullable|min:2',
|
||||||
'price' => 'numeric'
|
'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();
|
$pricing = new Pricing();
|
||||||
|
|
|
@ -31,7 +31,8 @@ class IPsController extends Controller
|
||||||
{
|
{
|
||||||
$request->validate([
|
$request->validate([
|
||||||
'address' => 'required|ip|min:2',
|
'address' => 'required|ip|min:2',
|
||||||
'ip_type' => 'required'
|
'ip_type' => 'required|string|size:4',
|
||||||
|
'service_id' => 'required|string'
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$ip_id = Str::random(8);
|
$ip_id = Str::random(8);
|
||||||
|
|
|
@ -25,7 +25,7 @@ class LabelsController extends Controller
|
||||||
public function store(Request $request)
|
public function store(Request $request)
|
||||||
{
|
{
|
||||||
$request->validate([
|
$request->validate([
|
||||||
'label' => 'required|min:2'
|
'label' => 'required|string|min:2'
|
||||||
]);
|
]);
|
||||||
|
|
||||||
Labels::create([
|
Labels::create([
|
||||||
|
|
|
@ -24,7 +24,7 @@ class LocationsController extends Controller
|
||||||
public function store(Request $request)
|
public function store(Request $request)
|
||||||
{
|
{
|
||||||
$request->validate([
|
$request->validate([
|
||||||
'location_name' => 'required|min:2'
|
'location_name' => 'required|string|min:2'
|
||||||
]);
|
]);
|
||||||
|
|
||||||
Locations::create([
|
Locations::create([
|
||||||
|
|
|
@ -32,9 +32,11 @@ class MiscController extends Controller
|
||||||
public function store(Request $request)
|
public function store(Request $request)
|
||||||
{
|
{
|
||||||
$request->validate([
|
$request->validate([
|
||||||
'name' => 'required|min:3',
|
'name' => 'required|string|min:3',
|
||||||
'price' => 'required|numeric',
|
'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'
|
'next_due_date' => 'required|date'
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
@ -65,17 +67,19 @@ class MiscController extends Controller
|
||||||
public function update(Request $request, Misc $misc)
|
public function update(Request $request, Misc $misc)
|
||||||
{
|
{
|
||||||
$request->validate([
|
$request->validate([
|
||||||
'name' => 'required',
|
'name' => 'required|string|min:3',
|
||||||
'owned_since' => 'date',
|
'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')
|
$misc->update([
|
||||||
->where('id', $misc->id)
|
'name' => $request->name,
|
||||||
->update([
|
'owned_since' => $request->owned_since,
|
||||||
'name' => $request->name,
|
'active' => (isset($request->is_active)) ? 1 : 0
|
||||||
'owned_since' => $request->owned_since,
|
]);
|
||||||
'active' => (isset($request->is_active)) ? 1 : 0
|
|
||||||
]);
|
|
||||||
|
|
||||||
$pricing = new Pricing();
|
$pricing = new Pricing();
|
||||||
$as_usd = $pricing->convertToUSD($request->price, $request->currency);
|
$as_usd = $pricing->convertToUSD($request->price, $request->currency);
|
||||||
|
|
|
@ -22,7 +22,7 @@ class OsController extends Controller
|
||||||
public function store(Request $request)
|
public function store(Request $request)
|
||||||
{
|
{
|
||||||
$request->validate([
|
$request->validate([
|
||||||
'os_name' => 'required|min:2'
|
'os_name' => 'required|string|min:2'
|
||||||
]);
|
]);
|
||||||
|
|
||||||
OS::create([
|
OS::create([
|
||||||
|
|
|
@ -24,7 +24,7 @@ class ProvidersController extends Controller
|
||||||
public function store(Request $request)
|
public function store(Request $request)
|
||||||
{
|
{
|
||||||
$request->validate([
|
$request->validate([
|
||||||
'provider_name' => 'required|min:2'
|
'provider_name' => 'required|string|min:2'
|
||||||
]);
|
]);
|
||||||
|
|
||||||
Providers::create([
|
Providers::create([
|
||||||
|
|
|
@ -31,26 +31,27 @@ class ResellerController extends Controller
|
||||||
{
|
{
|
||||||
$request->validate([
|
$request->validate([
|
||||||
'domain' => 'required|min:4',
|
'domain' => 'required|min:4',
|
||||||
'reseller_type' => 'required',
|
'reseller_type' => 'required|string',
|
||||||
'dedicated_ip' => 'present',
|
'disk' => 'integer',
|
||||||
'accounts' => 'numeric',
|
'os_id' => 'integer',
|
||||||
'server_type' => 'numeric',
|
'provider_id' => 'integer',
|
||||||
'ram' => 'numeric',
|
'location_id' => 'integer',
|
||||||
'disk' => 'numeric',
|
|
||||||
'os_id' => 'numeric',
|
|
||||||
'provider_id' => 'numeric',
|
|
||||||
'location_id' => 'numeric',
|
|
||||||
'price' => 'numeric',
|
'price' => 'numeric',
|
||||||
'payment_term' => 'numeric',
|
'payment_term' => 'integer',
|
||||||
'was_promo' => 'numeric',
|
'was_promo' => 'integer',
|
||||||
'owned_since' => 'date',
|
'owned_since' => 'sometimes|nullable|date',
|
||||||
'domains' => 'numeric',
|
'accounts' => 'integer',
|
||||||
'sub_domains' => 'numeric',
|
'domains' => 'integer',
|
||||||
'bandwidth' => 'numeric',
|
'sub_domains' => 'integer',
|
||||||
'email' => 'numeric',
|
'bandwidth' => 'integer',
|
||||||
'ftp' => 'numeric',
|
'email' => 'integer',
|
||||||
'db' => 'numeric',
|
'ftp' => 'integer',
|
||||||
'next_due_date' => 'required|date'
|
'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);
|
$reseller_id = Str::random(8);
|
||||||
|
@ -106,46 +107,47 @@ class ResellerController extends Controller
|
||||||
public function update(Request $request, Reseller $reseller)
|
public function update(Request $request, Reseller $reseller)
|
||||||
{
|
{
|
||||||
$request->validate([
|
$request->validate([
|
||||||
'id' => 'required|size:8',
|
|
||||||
'domain' => 'required|min:4',
|
'domain' => 'required|min:4',
|
||||||
'reseller_type' => 'required',
|
'reseller_type' => 'required|string',
|
||||||
'dedicated_ip' => 'present',
|
'disk' => 'integer',
|
||||||
'server_type' => 'numeric',
|
'os_id' => 'integer',
|
||||||
'disk' => 'numeric',
|
'provider_id' => 'integer',
|
||||||
'os_id' => 'numeric',
|
'location_id' => 'integer',
|
||||||
'provider_id' => 'numeric',
|
|
||||||
'location_id' => 'numeric',
|
|
||||||
'price' => 'numeric',
|
'price' => 'numeric',
|
||||||
'payment_term' => 'numeric',
|
'payment_term' => 'integer',
|
||||||
'was_promo' => 'numeric',
|
'was_promo' => 'integer',
|
||||||
'owned_since' => 'date',
|
'owned_since' => 'sometimes|nullable|date',
|
||||||
'domains' => 'numeric',
|
'accounts' => 'integer',
|
||||||
'sub_domains' => 'numeric',
|
'domains' => 'integer',
|
||||||
'bandwidth' => 'numeric',
|
'sub_domains' => 'integer',
|
||||||
'email' => 'numeric',
|
'bandwidth' => 'integer',
|
||||||
'ftp' => 'numeric',
|
'email' => 'integer',
|
||||||
'db' => 'numeric'
|
'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')
|
$reseller->update([
|
||||||
->where('id', $request->id)
|
'main_domain' => $request->domain,
|
||||||
->update([
|
'reseller_type' => $request->reseller_type,
|
||||||
'main_domain' => $request->domain,
|
'provider_id' => $request->provider_id,
|
||||||
'reseller_type' => $request->reseller_type,
|
'location_id' => $request->location_id,
|
||||||
'provider_id' => $request->provider_id,
|
'disk' => $request->disk,
|
||||||
'location_id' => $request->location_id,
|
'disk_type' => 'GB',
|
||||||
'disk' => $request->disk,
|
'disk_as_gb' => $request->disk,
|
||||||
'disk_type' => 'GB',
|
'owned_since' => $request->owned_since,
|
||||||
'disk_as_gb' => $request->disk,
|
'bandwidth' => $request->bandwidth,
|
||||||
'owned_since' => $request->owned_since,
|
'was_promo' => $request->was_promo,
|
||||||
'bandwidth' => $request->bandwidth,
|
'domains_limit' => $request->domains,
|
||||||
'was_promo' => $request->was_promo,
|
'subdomains_limit' => $request->sub_domains,
|
||||||
'domains_limit' => $request->domains,
|
'email_limit' => $request->email,
|
||||||
'subdomains_limit' => $request->sub_domains,
|
'ftp_limit' => $request->ftp,
|
||||||
'email_limit' => $request->email,
|
'db_limit' => $request->db
|
||||||
'ftp_limit' => $request->ftp,
|
]);
|
||||||
'db_limit' => $request->db
|
|
||||||
]);
|
|
||||||
|
|
||||||
$pricing = new Pricing();
|
$pricing = new Pricing();
|
||||||
$as_usd = $pricing->convertToUSD($request->price, $request->currency);
|
$as_usd = $pricing->convertToUSD($request->price, $request->currency);
|
||||||
|
|
|
@ -29,19 +29,23 @@ class SeedBoxesController extends Controller
|
||||||
public function store(Request $request)
|
public function store(Request $request)
|
||||||
{
|
{
|
||||||
$request->validate([
|
$request->validate([
|
||||||
'title' => 'required|string',
|
'title' => 'required|string|min:2',
|
||||||
'hostname' => 'string|nullable',
|
'hostname' => 'sometimes|nullable|string|min:2',
|
||||||
'seed_box_type' => 'required',
|
'seed_box_type' => 'required|string',
|
||||||
'provider_id' => 'numeric',
|
'provider_id' => 'integer',
|
||||||
'location_id' => 'numeric',
|
'location_id' => 'integer',
|
||||||
'price' => 'numeric',
|
'price' => 'numeric',
|
||||||
'payment_term' => 'numeric',
|
'payment_term' => 'integer',
|
||||||
'was_promo' => 'numeric',
|
'was_promo' => 'integer',
|
||||||
'owned_since' => 'date',
|
'owned_since' => 'sometimes|nullable|date',
|
||||||
'disk' => 'numeric',
|
'disk' => 'integer',
|
||||||
'bandwidth' => 'numeric',
|
'bandwidth' => 'integer',
|
||||||
'port_speed' => 'numeric',
|
'port_speed' => 'integer',
|
||||||
'next_due_date' => 'required|date'
|
'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);
|
$seedbox_id = Str::random(8);
|
||||||
|
@ -91,37 +95,39 @@ class SeedBoxesController extends Controller
|
||||||
public function update(Request $request, SeedBoxes $seedbox)
|
public function update(Request $request, SeedBoxes $seedbox)
|
||||||
{
|
{
|
||||||
$request->validate([
|
$request->validate([
|
||||||
'id' => 'required|size:8',
|
'title' => 'required|string|min:2',
|
||||||
'title' => 'required|string',
|
'hostname' => 'sometimes|nullable|string|min:2',
|
||||||
'hostname' => 'string|nullable',
|
'seed_box_type' => 'required|string',
|
||||||
'seed_box_type' => 'required',
|
'provider_id' => 'integer',
|
||||||
'disk' => 'numeric',
|
'location_id' => 'integer',
|
||||||
'provider_id' => 'numeric',
|
|
||||||
'location_id' => 'numeric',
|
|
||||||
'price' => 'numeric',
|
'price' => 'numeric',
|
||||||
'payment_term' => 'numeric',
|
'payment_term' => 'integer',
|
||||||
'was_promo' => 'numeric',
|
'was_promo' => 'integer',
|
||||||
'owned_since' => 'date',
|
'owned_since' => 'sometimes|nullable|date',
|
||||||
'bandwidth' => 'numeric',
|
'disk' => 'integer',
|
||||||
'port_speed' => 'numeric'
|
'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')
|
$seedbox->update([
|
||||||
->where('id', $seedbox->id)
|
'title' => $request->title,
|
||||||
->update([
|
'hostname' => $request->hostname,
|
||||||
'title' => $request->title,
|
'seed_box_type' => $request->seed_box_type,
|
||||||
'hostname' => $request->hostname,
|
'location_id' => $request->location_id,
|
||||||
'seed_box_type' => $request->seed_box_type,
|
'provider_id' => $request->provider_id,
|
||||||
'location_id' => $request->location_id,
|
'disk' => $request->disk,
|
||||||
'provider_id' => $request->provider_id,
|
'disk_type' => 'GB',
|
||||||
'disk' => $request->disk,
|
'disk_as_gb' => $request->disk,
|
||||||
'disk_type' => 'GB',
|
'owned_since' => $request->owned_since,
|
||||||
'disk_as_gb' => $request->disk,
|
'bandwidth' => $request->bandwidth,
|
||||||
'owned_since' => $request->owned_since,
|
'port_speed' => $request->port_speed,
|
||||||
'bandwidth' => $request->bandwidth,
|
'was_promo' => $request->was_promo
|
||||||
'port_speed' => $request->port_speed,
|
]);
|
||||||
'was_promo' => $request->was_promo
|
|
||||||
]);
|
|
||||||
|
|
||||||
$pricing = new Pricing();
|
$pricing = new Pricing();
|
||||||
$as_usd = $pricing->convertToUSD($request->price, $request->currency);
|
$as_usd = $pricing->convertToUSD($request->price, $request->currency);
|
||||||
|
|
|
@ -18,9 +18,7 @@ class ServerController extends Controller
|
||||||
public function index()
|
public function index()
|
||||||
{
|
{
|
||||||
$servers = Server::allActiveServers();
|
$servers = Server::allActiveServers();
|
||||||
|
|
||||||
$non_active_servers = Server::allNonActiveServers();
|
$non_active_servers = Server::allNonActiveServers();
|
||||||
|
|
||||||
return view('servers.index', compact(['servers', 'non_active_servers']));
|
return view('servers.index', compact(['servers', 'non_active_servers']));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,22 +41,30 @@ class ServerController extends Controller
|
||||||
|
|
||||||
public function store(Request $request)
|
public function store(Request $request)
|
||||||
{
|
{
|
||||||
|
|
||||||
$request->validate([
|
$request->validate([
|
||||||
'hostname' => 'required|min:5',
|
'hostname' => 'required|min:5',
|
||||||
'ip1' => 'nullable|ip',
|
'ip1' => 'sometimes|nullable|ip',
|
||||||
'ip2' => 'nullable|ip',
|
'ip2' => 'sometimes|nullable|ip',
|
||||||
'service_type' => 'numeric',
|
'ns1' => 'sometimes|nullable|string',
|
||||||
'server_type' => 'numeric',
|
'ns2' => 'sometimes|nullable|string',
|
||||||
'ram' => 'numeric',
|
'service_type' => 'integer',
|
||||||
'disk' => 'numeric',
|
'server_type' => 'integer',
|
||||||
'os_id' => 'numeric',
|
'ssh_port' => 'integer',
|
||||||
'provider_id' => 'numeric',
|
'bandwidth' => 'integer',
|
||||||
'location_id' => 'numeric',
|
'ram' => 'required|numeric',
|
||||||
'price' => 'numeric',
|
'disk' => 'required|integer',
|
||||||
'cpu' => 'numeric',
|
'os_id' => 'required|integer',
|
||||||
'was_promo' => 'numeric',
|
'provider_id' => 'required|integer',
|
||||||
'next_due_date' => 'required|date'
|
'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);
|
$server_id = Str::random(8);
|
||||||
|
@ -123,44 +129,55 @@ class ServerController extends Controller
|
||||||
{
|
{
|
||||||
$request->validate([
|
$request->validate([
|
||||||
'hostname' => 'required|min:5',
|
'hostname' => 'required|min:5',
|
||||||
'ram' => 'numeric',
|
'ip1' => 'sometimes|nullable|ip',
|
||||||
'disk' => 'numeric',
|
'ip2' => 'sometimes|nullable|ip',
|
||||||
'os_id' => 'numeric',
|
'ns1' => 'sometimes|nullable|string',
|
||||||
'provider_id' => 'numeric',
|
'ns2' => 'sometimes|nullable|string',
|
||||||
'location_id' => 'numeric',
|
'service_type' => 'integer',
|
||||||
'price' => 'numeric',
|
'server_type' => 'integer',
|
||||||
'cpu' => 'numeric',
|
'ssh_port' => 'integer',
|
||||||
'was_promo' => 'numeric',
|
'bandwidth' => 'integer',
|
||||||
'next_due_date' => 'date'
|
'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;
|
$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();
|
$pricing = new Pricing();
|
||||||
|
|
||||||
$as_usd = $pricing->convertToUSD($request->price, $request->currency);
|
$as_usd = $pricing->convertToUSD($request->price, $request->currency);
|
||||||
|
@ -209,7 +226,7 @@ class ServerController extends Controller
|
||||||
{//NOTICE: Selecting servers is not cached yet
|
{//NOTICE: Selecting servers is not cached yet
|
||||||
$all_servers = Server::where('has_yabs', 1)->get();
|
$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'));
|
return view('servers.choose-compare', compact('all_servers'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -222,7 +239,7 @@ class ServerController extends Controller
|
||||||
$server1_data = Server::server($server1);
|
$server1_data = Server::server($server1);
|
||||||
|
|
||||||
if (!isset($server1_data[0]->yabs[0])) {
|
if (!isset($server1_data[0]->yabs[0])) {
|
||||||
abort(404);
|
abort(404);
|
||||||
}
|
}
|
||||||
|
|
||||||
$server2_data = Server::server($server2);
|
$server2_data = Server::server($server2);
|
||||||
|
|
|
@ -29,24 +29,26 @@ class SharedController extends Controller
|
||||||
{
|
{
|
||||||
$request->validate([
|
$request->validate([
|
||||||
'domain' => 'required|min:4',
|
'domain' => 'required|min:4',
|
||||||
'shared_type' => 'required',
|
'shared_type' => 'required|string',
|
||||||
'server_type' => 'numeric',
|
'disk' => 'integer',
|
||||||
'ram' => 'numeric',
|
'os_id' => 'integer',
|
||||||
'disk' => 'numeric',
|
'provider_id' => 'integer',
|
||||||
'os_id' => 'numeric',
|
'location_id' => 'integer',
|
||||||
'provider_id' => 'numeric',
|
|
||||||
'location_id' => 'numeric',
|
|
||||||
'price' => 'numeric',
|
'price' => 'numeric',
|
||||||
'payment_term' => 'numeric',
|
'payment_term' => 'integer',
|
||||||
'was_promo' => 'numeric',
|
'was_promo' => 'integer',
|
||||||
'owned_since' => 'date',
|
'owned_since' => 'sometimes|nullable|date',
|
||||||
'domains' => 'numeric',
|
'domains' => 'integer',
|
||||||
'sub_domains' => 'numeric',
|
'sub_domains' => 'integer',
|
||||||
'bandwidth' => 'numeric',
|
'bandwidth' => 'integer',
|
||||||
'email' => 'numeric',
|
'email' => 'integer',
|
||||||
'ftp' => 'numeric',
|
'ftp' => 'integer',
|
||||||
'db' => 'numeric',
|
'db' => 'integer',
|
||||||
'next_due_date' => 'required|date'
|
'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);
|
$shared_id = Str::random(8);
|
||||||
|
@ -103,46 +105,46 @@ class SharedController extends Controller
|
||||||
public function update(Request $request, Shared $shared)
|
public function update(Request $request, Shared $shared)
|
||||||
{
|
{
|
||||||
$request->validate([
|
$request->validate([
|
||||||
'id' => 'required|size:8',
|
|
||||||
'domain' => 'required|min:4',
|
'domain' => 'required|min:4',
|
||||||
'shared_type' => 'required',
|
'shared_type' => 'required|string',
|
||||||
'dedicated_ip' => 'present',
|
'disk' => 'integer',
|
||||||
'server_type' => 'numeric',
|
'os_id' => 'integer',
|
||||||
'disk' => 'numeric',
|
'provider_id' => 'integer',
|
||||||
'os_id' => 'numeric',
|
'location_id' => 'integer',
|
||||||
'provider_id' => 'numeric',
|
|
||||||
'location_id' => 'numeric',
|
|
||||||
'price' => 'numeric',
|
'price' => 'numeric',
|
||||||
'payment_term' => 'numeric',
|
'payment_term' => 'integer',
|
||||||
'was_promo' => 'numeric',
|
'was_promo' => 'integer',
|
||||||
'owned_since' => 'date',
|
'owned_since' => 'sometimes|nullable|date',
|
||||||
'domains' => 'numeric',
|
'domains' => 'integer',
|
||||||
'sub_domains' => 'numeric',
|
'sub_domains' => 'integer',
|
||||||
'bandwidth' => 'numeric',
|
'bandwidth' => 'integer',
|
||||||
'email' => 'numeric',
|
'email' => 'integer',
|
||||||
'ftp' => 'numeric',
|
'ftp' => 'integer',
|
||||||
'db' => 'numeric'
|
'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')
|
$shared->update([
|
||||||
->where('id', $request->id)
|
'main_domain' => $request->domain,
|
||||||
->update([
|
'shared_type' => $request->shared_type,
|
||||||
'main_domain' => $request->domain,
|
'provider_id' => $request->provider_id,
|
||||||
'shared_type' => $request->shared_type,
|
'location_id' => $request->location_id,
|
||||||
'provider_id' => $request->provider_id,
|
'disk' => $request->disk,
|
||||||
'location_id' => $request->location_id,
|
'disk_type' => 'GB',
|
||||||
'disk' => $request->disk,
|
'disk_as_gb' => $request->disk,
|
||||||
'disk_type' => 'GB',
|
'owned_since' => $request->owned_since,
|
||||||
'disk_as_gb' => $request->disk,
|
'bandwidth' => $request->bandwidth,
|
||||||
'owned_since' => $request->owned_since,
|
'was_promo' => $request->was_promo,
|
||||||
'bandwidth' => $request->bandwidth,
|
'domains_limit' => $request->domains,
|
||||||
'was_promo' => $request->was_promo,
|
'subdomains_limit' => $request->sub_domains,
|
||||||
'domains_limit' => $request->domains,
|
'email_limit' => $request->email,
|
||||||
'subdomains_limit' => $request->sub_domains,
|
'ftp_limit' => $request->ftp,
|
||||||
'email_limit' => $request->email,
|
'db_limit' => $request->db
|
||||||
'ftp_limit' => $request->ftp,
|
]);
|
||||||
'db_limit' => $request->db
|
|
||||||
]);
|
|
||||||
|
|
||||||
$pricing = new Pricing();
|
$pricing = new Pricing();
|
||||||
$as_usd = $pricing->convertToUSD($request->price, $request->currency);
|
$as_usd = $pricing->convertToUSD($request->price, $request->currency);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user