laravel-learn-bbs/app/Console/Commands/CalculateActiveUser.php
2018-06-02 18:21:53 +08:00

45 lines
843 B
PHP

<?php
namespace App\Console\Commands;
use App\Models\User;
use Illuminate\Console\Command;
class CalculateActiveUser extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'larabbs:calculate-active-user';
/**
* The console command description.
*
* @var string
*/
protected $description = '生成活跃用户';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
* @param User $user
*/
public function handle(User $user)
{
$this->info('开始计算!');
$user->calculateAndCacheActiveUsers();
$this->info('生成成功!');
}
}