1
0
mirror of https://github.com/cp6/my-idlers.git synced 2024-11-16 23:42:32 +01:00

Added home page pricing break down func to cache

Added home page pricing break down func to cache
This commit is contained in:
cp6 2022-05-29 16:56:13 +10:00
parent f72eec01f7
commit 8e5a1f62c3
2 changed files with 38 additions and 35 deletions

View File

@ -60,6 +60,7 @@ class SettingsController extends Controller
Cache::forget('due_soon');//Main page due_soon cache Cache::forget('due_soon');//Main page due_soon cache
Cache::forget('recently_added');//Main page recently_added cache Cache::forget('recently_added');//Main page recently_added cache
Cache::forget('pricing_breakdown');//Main page pricing breakdown
Cache::forget('settings');//Main page settings cache Cache::forget('settings');//Main page settings cache

View File

@ -116,6 +116,7 @@ class Home extends Model
{ {
$pricing = json_decode($all_pricing, true); $pricing = json_decode($all_pricing, true);
return Cache::remember('pricing_breakdown', now()->addWeek(1), function () use ($pricing) {
$total_cost_weekly = $total_cost_pm = $inactive_count = 0; $total_cost_weekly = $total_cost_pm = $inactive_count = 0;
foreach ($pricing as $price) { foreach ($pricing as $price) {
if ($price['active'] === 1) { if ($price['active'] === 1) {
@ -155,6 +156,7 @@ class Home extends Model
'total_cost_yearly' => $total_cost_yearly, 'total_cost_yearly' => $total_cost_yearly,
'inactive_count' => $inactive_count, 'inactive_count' => $inactive_count,
); );
});
} }
public static function doServicesCount($services_count): array public static function doServicesCount($services_count): array