From e33559fddc90caae7842680e2d03eccbae55a72b Mon Sep 17 00:00:00 2001 From: cp6 Date: Sun, 15 May 2022 01:22:47 +1000 Subject: [PATCH] Updated pricing, labels and dns calls to be cached Updated pricing, labels and dns calls to be cached --- app/Http/Controllers/HomeController.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.php index 6b2ad4d..5a98977 100644 --- a/app/Http/Controllers/HomeController.php +++ b/app/Http/Controllers/HomeController.php @@ -2,6 +2,8 @@ namespace App\Http\Controllers; +use App\Models\DNS; +use App\Models\Labels; use App\Models\Pricing; use Carbon\Carbon; use Illuminate\Http\Request; @@ -120,7 +122,9 @@ class HomeController extends Controller Session::put('recently_added_amount', $settings[0]->recently_added_amount ?? 6); Session::save(); - $pricing = json_decode(DB::table('pricings')->get(), true); + $all_pricing = Pricing::allPricing(); + + $pricing = json_decode($all_pricing, true); $total_cost_weekly = $total_cost_pm = $inactive_count = 0; foreach ($pricing as $price) { @@ -177,8 +181,8 @@ class HomeController extends Controller 'shared' => $shared_count, 'reseller' => $reseller_count, 'misc' => $other_count, - 'labels' => DB::table('labels')->count(), - 'dns' => DB::table('d_n_s')->count(), + 'labels' => Labels::labelsCount(), + 'dns' => DNS::dnsCount(), 'total_services' => $total_services, 'total_inactive' => $inactive_count, 'total_cost_weekly' => number_format($total_cost_weekly, 2),