6
0
Fork 0
jiqu-library-server/app/Admin/Metrics/Store/TotalMoney.php

34 lines
717 B
PHP

<?php
namespace App\Admin\Metrics\Store;
use Dcat\Admin\Widgets\Metrics\Card;
use App\Models\Order;
class TotalMoney extends Card
{
protected function init()
{
parent::init();
$this->title('营业额');
$this->subTitle('订单营业额');
$money = floor(Order::whereNotNull('store_id')->where('status', Order::STATUS_COMPLETED)->sum('total_amount') / 100);
$this->withContent(number_format($money));
}
public function withContent($content)
{
return $this->content(
<<<HTML
<div class="card-body">
<h1 class="text-left">{$content}<h1>
</div>
HTML
);
}
}