From 3055c2f55094518eef09766665cc06bcfc46594c Mon Sep 17 00:00:00 2001 From: WBLKLeipe Date: Tue, 26 Oct 2021 16:24:57 +0200 Subject: [PATCH] Fixed Redundant code --- app/Http/Controllers/HomeController.php | 27 ++++++++++++------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.php index 4f6f57ce..b2c4384a 100644 --- a/app/Http/Controllers/HomeController.php +++ b/app/Http/Controllers/HomeController.php @@ -37,25 +37,24 @@ class HomeController extends Controller foreach (Auth::user()->servers as $server){ $usage += $server->product->price; } - + if(Auth::user()->Credits() > 0.01 and $usage > 0){ $days = number_format((Auth::user()->Credits()*30)/$usage,2,'.',''); $hours = number_format(Auth::user()->Credits()/($usage/30/24),2,'.',''); + + if($days >= 15){ + $bg = "success"; + }elseif ($days >= 8 && $days <= 14){ + $bg = "warning"; + }elseif ($days <= 7){ + $bg = "danger"; + } + echo '
-
'; - if($days >= 15){ - echo ''; - } - elseif ($days >= 8 && $days <= 14){ - echo ''; - } - elseif ($days <= 7){ - echo ''; - } - - echo ' - +
+ +
Out of '. Configuration::getValueByKey('CREDITS_DISPLAY_NAME').' in '; //IF TIME IS LESS THAN 1 DAY CHANGE TO "hours"