Files
RelaisSMS/app/Console/Commands/SyncCalDavCalendarCommand.php
T

33 lines
949 B
PHP

<?php
namespace App\Console\Commands;
use App\Services\Calendar\CalendarEventSyncService;
use Illuminate\Console\Command;
use Throwable;
class SyncCalDavCalendarCommand extends Command
{
protected $signature = 'calendar:sync-caldav';
protected $description = 'Synchronise les evenements depuis l agenda CalDAV configure.';
public function handle(CalendarEventSyncService $syncService): int
{
try {
$run = $syncService->sync();
} catch (Throwable $exception) {
$this->error('Synchronisation CalDAV agenda en echec : '.$exception->getMessage());
return self::FAILURE;
}
$this->info((string) $run->message);
$this->line('Objets lus : '.$run->fetched_contacts);
$this->line('Evenements synchronises : '.$run->synced_contacts);
$this->line('Evenements annules localement : '.$run->deleted_contacts);
return self::SUCCESS;
}
}