HEX
Server: Microsoft-IIS/8.5
System: Windows NT YDAWBH120 6.3 build 9600 (Windows Server 2012 R2 Standard Edition) AMD64
User: tentjecom_web (0)
PHP: 7.4.14
Disabled: NONE
Upload Files
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);
    }
}