Stuff
This commit is contained in:
parent
2e8b5f5f2a
commit
a76b8a05c5
2 changed files with 2 additions and 2 deletions
|
@ -41,7 +41,7 @@ class Storage extends Authenticatable
|
||||||
];
|
];
|
||||||
|
|
||||||
public static function getLastDays(int $days = 7) {
|
public static function getLastDays(int $days = 7) {
|
||||||
$sql = "SELECT `date`, `tenant`, (sum(size)/24) AS size FROM `storage` WHERE `tenant` = 1 GROUP BY `date`, `tenant` ORDER BY `date` DESC LIMIT ".$days.";";
|
$sql = "SELECT `date`, `tenant`, (sum(size)/24) AS size FROM `storage` WHERE `tenant` = ".session("current_tenant_id")." GROUP BY `date`, `tenant` ORDER BY `date` DESC LIMIT ".$days.";";
|
||||||
$res = DB::select($sql);
|
$res = DB::select($sql);
|
||||||
|
|
||||||
$now = new \DateTime( $days." days ago", new \DateTimeZone('UTC'));
|
$now = new \DateTime( $days." days ago", new \DateTimeZone('UTC'));
|
||||||
|
|
|
@ -47,7 +47,7 @@ class Traffic extends Authenticatable
|
||||||
];
|
];
|
||||||
|
|
||||||
public static function getLastDays(int $days = 7) {
|
public static function getLastDays(int $days = 7) {
|
||||||
$sql = "SELECT year, month, day, SUM(traffic) AS `traffic` FROM traffic WHERE tenant = 1 GROUP BY year, month, day ORDER BY year, month, day DESC LIMIT ".$days.";";
|
$sql = "SELECT year, month, day, SUM(traffic) AS `traffic` FROM traffic WHERE tenant = ".session("current_tenant_id")."GROUP BY year, month, day ORDER BY year, month, day DESC LIMIT ".$days.";";
|
||||||
$res = DB::select($sql);
|
$res = DB::select($sql);
|
||||||
|
|
||||||
$now = new \DateTime( $days." days ago", new \DateTimeZone('UTC'));
|
$now = new \DateTime( $days." days ago", new \DateTimeZone('UTC'));
|
||||||
|
|
Loading…
Reference in a new issue