App\Console\Commands\UserForumStatSyncCommand::handle PHP Method

handle() public method

Execute the console command.
public handle ( ) : mixed
return mixed
    public function handle()
    {
        $this->info('Synchronising user post counts...');
        $this->progress = $this->output->createProgressBar(User::count());
        User::chunk(1000, function ($users) {
            foreach ($users as $u) {
                $u->refreshForumCache();
                $this->progress->advance();
            }
        });
        $this->progress->finish();
    }