移除 测试命令
This commit is contained in:
parent
a30c8af278
commit
13c2db2c3e
@ -1,44 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Models\Balance;
|
||||
use Illuminate\Console\Command;
|
||||
use Symfony\Component\Console\Command\Command as CommandAlias;
|
||||
|
||||
class TestCommand extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'test-command';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = '测试用的命令。';
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function handle(): int
|
||||
{
|
||||
|
||||
// 使用 SQL 语句,统计 Balance 模型中,根据 payment 类别,计算出数据总和 (group by date and payment)(date 类型要求 datetime)
|
||||
$balances = Balance::selectRaw('date(created_at) as date, payment, sum(amount) as total')
|
||||
->groupBy('date', 'payment')
|
||||
->get();
|
||||
|
||||
|
||||
// table
|
||||
$this->table(['支付方式', '数量', '日期'], $balances->toArray());
|
||||
|
||||
return CommandAlias::SUCCESS;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user