File: D:/HostingSpaces/netwerkbrabant/netwerkbrabant.nl/app/Console/Commands/SyncWeFactEvents.php
<?php
namespace App\Console\Commands;
use App\KommaApp\Events\EventService;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Log;
class SyncWeFactEvents extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'wefact:sync';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Sync all events from WeFact';
/** @var EventService $eventService */
private $eventService;
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
$this->eventService = app()->make(EventService::class);
}
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
$eventsUpdated = $this->eventService->syncAllRelevantEvents();
$logMessage = $eventsUpdated . ' event(s) have been updated.';
$this->info($logMessage);
Log::info(self::class.': '. $logMessage);
}
}