Auto-formatted by Laravel Pint (default Laravel preset): string concatenation spacing, anonymous class brace placement, constructor body shorthand, import ordering, and assertion indentation.
34 lines
1,012 B
PHP
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;
|
|
}
|
|
}
|
|
}
|