File: /var/www/vhost/disk-apps/qas.sports-crowd.com/app/Console/Commands/TeamDataSync.php
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use App\Http\Controllers\StatisticsController;
use App\TeamStatistic;
class TeamDataSync extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'sportscrowd:teamDataSync';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Sincronización de los datos estadisticos del equipo, partidos y clasificación según la liga del pais';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return int
*/
public function handle()
{
$teamStatistic = TeamStatistic::first();
if (!$teamStatistic || !$teamStatistic->active) {
return 0;
}
$controller = new StatisticsController;
$controller->syncData(true, $teamStatistic);
return 1;
}
}