Updated all destroy() methods
Updated all destroy() methods to directly delete the resource rather than fetch from database which turns out is not needed
This commit is contained in:
parent
74691a6ed8
commit
3bd9d5890c
|
@ -123,14 +123,11 @@ class DNSController extends Controller
|
||||||
|
|
||||||
public function destroy(DNS $dn)
|
public function destroy(DNS $dn)
|
||||||
{
|
{
|
||||||
$id = $dn->id;
|
$dn->delete();
|
||||||
$items = DNS::find($id);
|
|
||||||
|
|
||||||
$items->delete();
|
|
||||||
|
|
||||||
Cache::forget('dns_count');
|
Cache::forget('dns_count');
|
||||||
|
|
||||||
Labels::deleteLabelsAssignedTo($id);
|
Labels::deleteLabelsAssignedTo($dn->id);
|
||||||
|
|
||||||
return redirect()->route('dns.index')
|
return redirect()->route('dns.index')
|
||||||
->with('success', 'DNS was deleted Successfully.');
|
->with('success', 'DNS was deleted Successfully.');
|
||||||
|
|
|
@ -127,8 +127,7 @@ class DomainsController extends Controller
|
||||||
|
|
||||||
public function destroy(Domains $domain)
|
public function destroy(Domains $domain)
|
||||||
{
|
{
|
||||||
$items = Domains::find($domain->id);
|
$domain->delete();
|
||||||
$items->delete();
|
|
||||||
|
|
||||||
$p = new Pricing();
|
$p = new Pricing();
|
||||||
$p->deletePricing($domain->id);
|
$p->deletePricing($domain->id);
|
||||||
|
|
|
@ -51,8 +51,7 @@ class IPsController extends Controller
|
||||||
|
|
||||||
public function destroy(IPs $IP)
|
public function destroy(IPs $IP)
|
||||||
{
|
{
|
||||||
$items = IPs::find($IP->id);
|
$IP->delete();
|
||||||
$items->delete();
|
|
||||||
|
|
||||||
return redirect()->route('IPs.index')
|
return redirect()->route('IPs.index')
|
||||||
->with('success', 'IP address was deleted Successfully.');
|
->with('success', 'IP address was deleted Successfully.');
|
||||||
|
|
|
@ -61,15 +61,11 @@ class LabelsController extends Controller
|
||||||
|
|
||||||
public function destroy(Labels $label)
|
public function destroy(Labels $label)
|
||||||
{
|
{
|
||||||
$label_id = $label->id;
|
$label->delete();
|
||||||
|
|
||||||
$items = Labels::find($label_id);
|
|
||||||
|
|
||||||
$items->delete();
|
|
||||||
|
|
||||||
Cache::forget('labels_count');
|
Cache::forget('labels_count');
|
||||||
|
|
||||||
Labels::deleteLabelAssignedAs($label_id);
|
Labels::deleteLabelAssignedAs($label->id);
|
||||||
|
|
||||||
Cache::forget('all_labels');
|
Cache::forget('all_labels');
|
||||||
|
|
||||||
|
|
|
@ -61,9 +61,7 @@ class LocationsController extends Controller
|
||||||
|
|
||||||
public function destroy(Locations $location)
|
public function destroy(Locations $location)
|
||||||
{
|
{
|
||||||
$items = Locations::find($location->id);
|
$location->delete();
|
||||||
|
|
||||||
$items->delete();
|
|
||||||
|
|
||||||
Cache::forget('locations');
|
Cache::forget('locations');
|
||||||
|
|
||||||
|
|
|
@ -94,8 +94,7 @@ class MiscController extends Controller
|
||||||
|
|
||||||
public function destroy(Misc $misc)
|
public function destroy(Misc $misc)
|
||||||
{
|
{
|
||||||
$items = Misc::find($misc->id);
|
$misc->delete();
|
||||||
$items->delete();
|
|
||||||
|
|
||||||
$p = new Pricing();
|
$p = new Pricing();
|
||||||
$p->deletePricing($misc->id);
|
$p->deletePricing($misc->id);
|
||||||
|
|
|
@ -37,9 +37,7 @@ class OsController extends Controller
|
||||||
|
|
||||||
public function destroy(OS $o)
|
public function destroy(OS $o)
|
||||||
{
|
{
|
||||||
$items = OS::find($o->id);
|
$o->delete();
|
||||||
|
|
||||||
$items->delete();
|
|
||||||
|
|
||||||
Cache::forget('operating_systems');
|
Cache::forget('operating_systems');
|
||||||
|
|
||||||
|
|
|
@ -7,13 +7,5 @@ use Illuminate\Http\Request;
|
||||||
|
|
||||||
class PricingController extends Controller
|
class PricingController extends Controller
|
||||||
{
|
{
|
||||||
public function index()
|
|
||||||
{
|
|
||||||
//
|
|
||||||
}
|
|
||||||
|
|
||||||
public function destroy(Pricing $pricing)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,9 +46,7 @@ class ProvidersController extends Controller
|
||||||
|
|
||||||
public function destroy(Providers $provider)
|
public function destroy(Providers $provider)
|
||||||
{
|
{
|
||||||
$items = Providers::find($provider->id);
|
$provider->delete();
|
||||||
|
|
||||||
$items->delete();
|
|
||||||
|
|
||||||
Cache::forget('providers');
|
Cache::forget('providers');
|
||||||
|
|
||||||
|
|
|
@ -174,19 +174,17 @@ class ResellerController extends Controller
|
||||||
|
|
||||||
public function destroy(Reseller $reseller)
|
public function destroy(Reseller $reseller)
|
||||||
{
|
{
|
||||||
$reseller_id = $reseller->id;
|
$reseller->delete();
|
||||||
$items = Reseller::find($reseller_id);
|
|
||||||
$items->delete();
|
|
||||||
|
|
||||||
$p = new Pricing();
|
$p = new Pricing();
|
||||||
$p->deletePricing($reseller_id);
|
$p->deletePricing($reseller->id);
|
||||||
|
|
||||||
Labels::deleteLabelsAssignedTo($reseller_id);
|
Labels::deleteLabelsAssignedTo($reseller->id);
|
||||||
|
|
||||||
IPs::deleteIPsAssignedTo($reseller_id);
|
IPs::deleteIPsAssignedTo($reseller->id);
|
||||||
|
|
||||||
Cache::forget("all_reseller");
|
Cache::forget("all_reseller");
|
||||||
Cache::forget("reseller_hosting.$reseller_id");
|
Cache::forget("reseller_hosting.$reseller->id");
|
||||||
Home::homePageCacheForget();
|
Home::homePageCacheForget();
|
||||||
|
|
||||||
return redirect()->route('reseller.index')
|
return redirect()->route('reseller.index')
|
||||||
|
|
|
@ -146,14 +146,12 @@ class SeedBoxesController extends Controller
|
||||||
|
|
||||||
public function destroy(SeedBoxes $seedbox)
|
public function destroy(SeedBoxes $seedbox)
|
||||||
{
|
{
|
||||||
$seedbox_id = $seedbox->id;
|
$seedbox->delete();
|
||||||
$items = SeedBoxes::find($seedbox_id);
|
|
||||||
$items->delete();
|
|
||||||
|
|
||||||
$p = new Pricing();
|
$p = new Pricing();
|
||||||
$p->deletePricing($seedbox_id);
|
$p->deletePricing( $seedbox->id);
|
||||||
|
|
||||||
Labels::deleteLabelsAssignedTo($seedbox_id);
|
Labels::deleteLabelsAssignedTo( $seedbox->id);
|
||||||
|
|
||||||
Cache::forget("all_seedboxes");
|
Cache::forget("all_seedboxes");
|
||||||
Cache::forget("seedbox.{$seedbox->id}");
|
Cache::forget("seedbox.{$seedbox->id}");
|
||||||
|
|
|
@ -199,8 +199,7 @@ class ServerController extends Controller
|
||||||
|
|
||||||
public function destroy(Server $server)
|
public function destroy(Server $server)
|
||||||
{
|
{
|
||||||
$item = Server::find($server->id);
|
$server->delete();
|
||||||
$item->delete();
|
|
||||||
|
|
||||||
$p = new Pricing();
|
$p = new Pricing();
|
||||||
$p->deletePricing($server->id);
|
$p->deletePricing($server->id);
|
||||||
|
|
|
@ -168,18 +168,16 @@ class SharedController extends Controller
|
||||||
|
|
||||||
public function destroy(Shared $shared)
|
public function destroy(Shared $shared)
|
||||||
{
|
{
|
||||||
$shared_id = $shared->id;
|
$shared->delete();
|
||||||
$items = Shared::find($shared_id);
|
|
||||||
$items->delete();
|
|
||||||
|
|
||||||
$p = new Pricing();
|
$p = new Pricing();
|
||||||
$p->deletePricing($shared_id);
|
$p->deletePricing($shared->id);
|
||||||
|
|
||||||
Labels::deleteLabelsAssignedTo($shared_id);
|
Labels::deleteLabelsAssignedTo($shared->id);
|
||||||
|
|
||||||
IPs::deleteIPsAssignedTo($shared_id);
|
IPs::deleteIPsAssignedTo($shared->id);
|
||||||
|
|
||||||
Cache::forget("shared_hosting.$shared_id");
|
Cache::forget("shared_hosting.$shared->id");
|
||||||
Cache::forget('all_shared');
|
Cache::forget('all_shared');
|
||||||
Home::homePageCacheForget();
|
Home::homePageCacheForget();
|
||||||
|
|
||||||
|
|
|
@ -32,8 +32,7 @@ class YabsController extends Controller
|
||||||
|
|
||||||
public function destroy(Yabs $yab)
|
public function destroy(Yabs $yab)
|
||||||
{
|
{
|
||||||
$yabs = Yabs::find($yab->id);
|
$yab->delete();
|
||||||
$yabs->delete();
|
|
||||||
|
|
||||||
if (Server::serverYabsAmount($yab->server_id) === 0) {
|
if (Server::serverYabsAmount($yab->server_id) === 0) {
|
||||||
DB::table('servers')
|
DB::table('servers')
|
||||||
|
|
Loading…
Reference in New Issue
Block a user