pp-planer/app/Console/Commands/SyncChurchToolsCommand.php
Thorsten Bus 04d271f96a style: apply Laravel Pint formatting across codebase
Auto-formatted by Laravel Pint (default Laravel preset): string
concatenation spacing, anonymous class brace placement, constructor
body shorthand, import ordering, and assertion indentation.
2026-03-02 23:02:03 +01:00

34 lines
1,012 B
PHP

<?php
namespace App\Console\Commands;
use App\Services\ChurchToolsService;
use Illuminate\Console\Command;
use Throwable;
class SyncChurchToolsCommand extends Command
{
protected $signature = 'cts:sync';
protected $description = 'Synchronisiert Gottesdienste und Songs aus ChurchTools';
public function handle(ChurchToolsService $churchToolsService): int
{
try {
$summary = $churchToolsService->sync();
$this->info('Daten wurden aktualisiert');
$this->line('Services: '.$summary['services_count']);
$this->line('Songs in Agenda: '.$summary['songs_count']);
$this->line('Gematchte Songs: '.$summary['matched_songs_count']);
$this->line('Nicht gematchte Songs: '.$summary['unmatched_songs_count']);
return self::SUCCESS;
} catch (Throwable $exception) {
$this->error('Fehler beim Synchronisieren: '.$exception->getMessage());
return self::FAILURE;
}
}
}