Added home page cache forgets upon CUD

Added home page cache forgets upon CUD
This commit is contained in:
cp6 2022-03-01 15:59:46 +11:00
parent 07b8cd14c1
commit 413aac5d2f
6 changed files with 68 additions and 0 deletions

View File

@ -7,6 +7,7 @@ use App\Models\Labels;
use App\Models\Pricing; use App\Models\Pricing;
use App\Models\Providers; use App\Models\Providers;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\DB;
use Illuminate\Support\Str; use Illuminate\Support\Str;
@ -92,6 +93,10 @@ class DomainsController extends Controller
} }
} }
Cache::forget('services_count');//Main page services_count cache
Cache::forget('due_soon');//Main page due_soon cache
Cache::forget('recently_added');//Main page recently_added cache
return redirect()->route('domains.index') return redirect()->route('domains.index')
->with('success', 'Domain Created Successfully.'); ->with('success', 'Domain Created Successfully.');
} }
@ -158,6 +163,10 @@ class DomainsController extends Controller
} }
} }
Cache::forget('services_count');//Main page services_count cache
Cache::forget('due_soon');//Main page due_soon cache
Cache::forget('recently_added');//Main page recently_added cache
return redirect()->route('domains.index') return redirect()->route('domains.index')
->with('success', 'Domain Updated Successfully.'); ->with('success', 'Domain Updated Successfully.');
} }
@ -173,6 +182,10 @@ class DomainsController extends Controller
Labels::deleteLabelsAssignedTo($domain->id); Labels::deleteLabelsAssignedTo($domain->id);
Cache::forget('services_count');//Main page services_count cache
Cache::forget('due_soon');//Main page due_soon cache
Cache::forget('recently_added');//Main page recently_added cache
return redirect()->route('domains.index') return redirect()->route('domains.index')
->with('success', 'Domain was deleted Successfully.'); ->with('success', 'Domain was deleted Successfully.');
} }

View File

@ -5,6 +5,7 @@ namespace App\Http\Controllers;
use App\Models\Misc; use App\Models\Misc;
use App\Models\Pricing; use App\Models\Pricing;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\DB;
use Illuminate\Support\Str; use Illuminate\Support\Str;
@ -66,6 +67,10 @@ class MiscController extends Controller
'next_due_date' => $request->next_due_date, 'next_due_date' => $request->next_due_date,
]); ]);
Cache::forget('services_count');//Main page services_count cache
Cache::forget('due_soon');//Main page due_soon cache
Cache::forget('recently_added');//Main page recently_added cache
return redirect()->route('misc.index') return redirect()->route('misc.index')
->with('success', 'Misc service created Successfully.'); ->with('success', 'Misc service created Successfully.');
} }
@ -111,6 +116,10 @@ class MiscController extends Controller
'active' => (isset($request->is_active)) ? 1 : 0 'active' => (isset($request->is_active)) ? 1 : 0
]); ]);
Cache::forget('services_count');//Main page services_count cache
Cache::forget('due_soon');//Main page due_soon cache
Cache::forget('recently_added');//Main page recently_added cache
return redirect()->route('misc.index') return redirect()->route('misc.index')
->with('success', 'Misc service updated Successfully.'); ->with('success', 'Misc service updated Successfully.');
} }
@ -124,6 +133,10 @@ class MiscController extends Controller
$p = new Pricing(); $p = new Pricing();
$p->deletePricing($misc->id); $p->deletePricing($misc->id);
Cache::forget('services_count');//Main page services_count cache
Cache::forget('due_soon');//Main page due_soon cache
Cache::forget('recently_added');//Main page recently_added cache
return redirect()->route('misc.index') return redirect()->route('misc.index')
->with('success', 'Misc service was deleted Successfully.'); ->with('success', 'Misc service was deleted Successfully.');
} }

View File

@ -9,6 +9,7 @@ use App\Models\Pricing;
use App\Models\Providers; use App\Models\Providers;
use App\Models\Reseller; use App\Models\Reseller;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\DB;
use Illuminate\Support\Str; use Illuminate\Support\Str;
@ -108,6 +109,10 @@ class ResellerController extends Controller
); );
} }
Cache::forget('services_count');//Main page services_count cache
Cache::forget('due_soon');//Main page due_soon cache
Cache::forget('recently_added');//Main page recently_added cache
return redirect()->route('reseller.index') return redirect()->route('reseller.index')
->with('success', 'Reseller hosting created Successfully.'); ->with('success', 'Reseller hosting created Successfully.');
} }
@ -221,6 +226,10 @@ class ResellerController extends Controller
]); ]);
} }
Cache::forget('services_count');//Main page services_count cache
Cache::forget('due_soon');//Main page due_soon cache
Cache::forget('recently_added');//Main page recently_added cache
return redirect()->route('reseller.index') return redirect()->route('reseller.index')
->with('success', 'Reseller hosting updated Successfully.'); ->with('success', 'Reseller hosting updated Successfully.');
} }
@ -239,6 +248,10 @@ class ResellerController extends Controller
IPs::deleteIPsAssignedTo($id); IPs::deleteIPsAssignedTo($id);
Cache::forget('services_count');//Main page services_count cache
Cache::forget('due_soon');//Main page due_soon cache
Cache::forget('recently_added');//Main page recently_added cache
return redirect()->route('reseller.index') return redirect()->route('reseller.index')
->with('success', 'Reseller hosting was deleted Successfully.'); ->with('success', 'Reseller hosting was deleted Successfully.');
} }

View File

@ -11,6 +11,7 @@ use App\Models\Providers;
use App\Models\Locations; use App\Models\Locations;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\Config; use Illuminate\Support\Facades\Config;
use Illuminate\Support\Facades\Session; use Illuminate\Support\Facades\Session;
use Illuminate\Support\Str; use Illuminate\Support\Str;
@ -161,6 +162,10 @@ class ServerController extends Controller
} }
} }
Cache::forget('services_count');//Main page services_count cache
Cache::forget('due_soon');//Main page due_soon cache
Cache::forget('recently_added');//Main page recently_added cache
return redirect()->route('servers.index') return redirect()->route('servers.index')
->with('success', 'Server Created Successfully.'); ->with('success', 'Server Created Successfully.');
} }
@ -296,6 +301,10 @@ class ServerController extends Controller
} }
} }
Cache::forget('services_count');//Main page services_count cache
Cache::forget('due_soon');//Main page due_soon cache
Cache::forget('recently_added');//Main page recently_added cache
return redirect()->route('servers.index') return redirect()->route('servers.index')
->with('success', 'Server Updated Successfully.'); ->with('success', 'Server Updated Successfully.');
} }
@ -313,6 +322,10 @@ class ServerController extends Controller
IPs::deleteIPsAssignedTo($server->id); IPs::deleteIPsAssignedTo($server->id);
Cache::forget('services_count');//Main page services_count cache
Cache::forget('due_soon');//Main page due_soon cache
Cache::forget('recently_added');//Main page recently_added cache
return redirect()->route('servers.index') return redirect()->route('servers.index')
->with('success', 'Server was deleted Successfully.'); ->with('success', 'Server was deleted Successfully.');
} }

View File

@ -4,6 +4,7 @@ namespace App\Http\Controllers;
use App\Models\Settings; use App\Models\Settings;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Session; use Illuminate\Support\Facades\Session;
@ -53,6 +54,8 @@ class SettingsController extends Controller
Session::put('show_server_value_location', $request->show_server_value_location); Session::put('show_server_value_location', $request->show_server_value_location);
Session::save(); Session::save();
Cache::forget('settings');//Main page settings cache
return redirect()->route('settings.index') return redirect()->route('settings.index')
->with('success', 'Settings Updated Successfully.'); ->with('success', 'Settings Updated Successfully.');
} }

View File

@ -9,6 +9,7 @@ use App\Models\Pricing;
use App\Models\Providers; use App\Models\Providers;
use App\Models\Shared; use App\Models\Shared;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\DB;
use Illuminate\Support\Str; use Illuminate\Support\Str;
@ -113,6 +114,10 @@ class SharedController extends Controller
); );
} }
Cache::forget('services_count');//Main page services_count cache
Cache::forget('due_soon');//Main page due_soon cache
Cache::forget('recently_added');//Main page recently_added cache
return redirect()->route('shared.index') return redirect()->route('shared.index')
->with('success', 'Shared hosting created Successfully.'); ->with('success', 'Shared hosting created Successfully.');
} }
@ -239,6 +244,10 @@ class SharedController extends Controller
]); ]);
} }
Cache::forget('services_count');//Main page services_count cache
Cache::forget('due_soon');//Main page due_soon cache
Cache::forget('recently_added');//Main page recently_added cache
return redirect()->route('shared.index') return redirect()->route('shared.index')
->with('success', 'Shared hosting updated Successfully.'); ->with('success', 'Shared hosting updated Successfully.');
} }
@ -257,6 +266,10 @@ class SharedController extends Controller
IPs::deleteIPsAssignedTo($shared->id); IPs::deleteIPsAssignedTo($shared->id);
Cache::forget('services_count');//Main page services_count cache
Cache::forget('due_soon');//Main page due_soon cache
Cache::forget('recently_added');//Main page recently_added cache
return redirect()->route('shared.index') return redirect()->route('shared.index')
->with('success', 'Shared hosting was deleted Successfully.'); ->with('success', 'Shared hosting was deleted Successfully.');
} }