diff --git a/app/Console/Commands/SyncChurchToolsCommand.php b/app/Console/Commands/SyncChurchToolsCommand.php index 6f96ba3..c1dde2e 100644 --- a/app/Console/Commands/SyncChurchToolsCommand.php +++ b/app/Console/Commands/SyncChurchToolsCommand.php @@ -18,14 +18,14 @@ public function handle(ChurchToolsService $churchToolsService): int $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']); + $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()); + $this->error('Fehler beim Synchronisieren: '.$exception->getMessage()); return self::FAILURE; } diff --git a/app/Cts/CtsApiSpikeSync.php b/app/Cts/CtsApiSpikeSync.php index 3b510af..bfc475a 100644 --- a/app/Cts/CtsApiSpikeSync.php +++ b/app/Cts/CtsApiSpikeSync.php @@ -50,7 +50,7 @@ public static function run( try { $events = EventRequest::where('from', $fromDate)->get(); - $songResponse = CTClient::getClient()->get('/api/songs/' . $songId); + $songResponse = CTClient::getClient()->get('/api/songs/'.$songId); $songRaw = CTResponseUtil::dataAsArray($songResponse); $song = Song::createModelFromData($songRaw); } catch (Throwable $throwable) { diff --git a/app/Events/PowerPointConversionProgress.php b/app/Events/PowerPointConversionProgress.php index a64a04b..1453df8 100644 --- a/app/Events/PowerPointConversionProgress.php +++ b/app/Events/PowerPointConversionProgress.php @@ -18,6 +18,5 @@ public function __construct( public int $processedPages = 0, public int $totalPages = 0, public array $convertedFiles = [], - ) { - } + ) {} } diff --git a/app/Http/Controllers/ArrangementController.php b/app/Http/Controllers/ArrangementController.php index e449876..d3b7cc8 100644 --- a/app/Http/Controllers/ArrangementController.php +++ b/app/Http/Controllers/ArrangementController.php @@ -101,7 +101,7 @@ public function update(Request $request, SongArrangement $arrangement): Redirect $arrangement->arrangementGroups()->insert($rows); } - if (!empty($data['group_colors'])) { + if (! empty($data['group_colors'])) { foreach ($data['group_colors'] as $groupId => $color) { $arrangement->song->groups() ->whereKey((int) $groupId) diff --git a/app/Http/Controllers/ProFileController.php b/app/Http/Controllers/ProFileController.php index 8c930c1..e6949a1 100644 --- a/app/Http/Controllers/ProFileController.php +++ b/app/Http/Controllers/ProFileController.php @@ -27,13 +27,13 @@ public function importPro(Request $request): JsonResponse } try { - $service = new ProImportService(); + $service = new ProImportService; $songs = $service->import($file); return response()->json([ 'message' => count($songs) === 1 ? "Song \"{$songs[0]->title}\" erfolgreich importiert." - : count($songs) . ' Songs erfolgreich importiert.', + : count($songs).' Songs erfolgreich importiert.', 'songs' => collect($songs)->map(fn (Song $song) => [ 'id' => $song->id, 'title' => $song->title, @@ -53,10 +53,10 @@ public function downloadPro(Song $song): BinaryFileResponse abort(422, 'Song hat keine Gruppen oder Slides zum Exportieren.'); } - $exportService = new ProExportService(); + $exportService = new ProExportService; $tempPath = $exportService->generateProFile($song); - $filename = preg_replace('/[^a-zA-Z0-9äöüÄÖÜß\-_ ]/', '', $song->title) . '.pro'; + $filename = preg_replace('/[^a-zA-Z0-9äöüÄÖÜß\-_ ]/', '', $song->title).'.pro'; return response()->download($tempPath, $filename)->deleteFileAfterSend(true); } diff --git a/app/Http/Controllers/ServiceSongController.php b/app/Http/Controllers/ServiceSongController.php index 3b8caa1..db09f83 100644 --- a/app/Http/Controllers/ServiceSongController.php +++ b/app/Http/Controllers/ServiceSongController.php @@ -12,8 +12,7 @@ class ServiceSongController extends Controller { public function __construct( private readonly SongMatchingService $songMatchingService, - ) { - } + ) {} /** * Manuell einen Song aus der DB einem ServiceSong zuordnen. diff --git a/app/Http/Controllers/SongController.php b/app/Http/Controllers/SongController.php index 1913950..70ea0d2 100644 --- a/app/Http/Controllers/SongController.php +++ b/app/Http/Controllers/SongController.php @@ -13,8 +13,7 @@ class SongController extends Controller { public function __construct( private readonly SongService $songService, - ) { - } + ) {} /** * Alle Songs auflisten (paginiert, durchsuchbar). diff --git a/app/Http/Controllers/SyncController.php b/app/Http/Controllers/SyncController.php index 4d09965..317ca8a 100644 --- a/app/Http/Controllers/SyncController.php +++ b/app/Http/Controllers/SyncController.php @@ -14,7 +14,7 @@ public function sync(ChurchToolsService $service): RedirectResponse return back()->with('success', 'Daten wurden aktualisiert'); } catch (\Throwable $e) { - return back()->with('error', 'Sync fehlgeschlagen: ' . $e->getMessage()); + return back()->with('error', 'Sync fehlgeschlagen: '.$e->getMessage()); } } } diff --git a/app/Http/Controllers/TranslationController.php b/app/Http/Controllers/TranslationController.php index b03dea5..04f192b 100644 --- a/app/Http/Controllers/TranslationController.php +++ b/app/Http/Controllers/TranslationController.php @@ -13,8 +13,7 @@ class TranslationController extends Controller { public function __construct( private readonly TranslationService $translationService, - ) { - } + ) {} public function page(Song $song): Response { diff --git a/app/Jobs/ConvertPowerPointJob.php b/app/Jobs/ConvertPowerPointJob.php index abb15e8..f80e474 100644 --- a/app/Jobs/ConvertPowerPointJob.php +++ b/app/Jobs/ConvertPowerPointJob.php @@ -23,14 +23,13 @@ class ConvertPowerPointJob implements ShouldQueue public function __construct( public string $inputPath, public string $jobId, - ) { - } + ) {} public function handle(FileConversionService $conversionService): void { event(new PowerPointConversionProgress($this->jobId, 'started')); - $tempDir = storage_path('app/temp/ppt-' . $this->jobId); + $tempDir = storage_path('app/temp/ppt-'.$this->jobId); if (! is_dir($tempDir) && ! mkdir($tempDir, 0775, true) && ! is_dir($tempDir)) { throw new RuntimeException('Temporaires Verzeichnis konnte nicht erstellt werden.'); } @@ -49,10 +48,10 @@ public function handle(FileConversionService $conversionService): void $process->run(); if (! $process->isSuccessful()) { - throw new RuntimeException('PowerPoint-Konvertierung fehlgeschlagen: ' . $process->getErrorOutput()); + throw new RuntimeException('PowerPoint-Konvertierung fehlgeschlagen: '.$process->getErrorOutput()); } - $pdfPath = $tempDir . DIRECTORY_SEPARATOR . pathinfo($this->inputPath, PATHINFO_FILENAME) . '.pdf'; + $pdfPath = $tempDir.DIRECTORY_SEPARATOR.pathinfo($this->inputPath, PATHINFO_FILENAME).'.pdf'; if (! is_file($pdfPath)) { throw new RuntimeException('PDF wurde von LibreOffice nicht erzeugt.'); } @@ -63,7 +62,7 @@ public function handle(FileConversionService $conversionService): void $convertedFiles = []; for ($page = 1; $page <= $pageCount; $page++) { - $slidePath = $tempDir . DIRECTORY_SEPARATOR . 'slide-' . $page . '.jpg'; + $slidePath = $tempDir.DIRECTORY_SEPARATOR.'slide-'.$page.'.jpg'; $pdf->selectPage($page)->save($slidePath); $convertedFiles[] = $conversionService->convertImage($slidePath); @@ -104,7 +103,7 @@ private function cleanup(string $tempDir): void continue; } - $path = $tempDir . DIRECTORY_SEPARATOR . $entry; + $path = $tempDir.DIRECTORY_SEPARATOR.$entry; if (is_file($path)) { @unlink($path); diff --git a/app/Mail/MissingSongRequest.php b/app/Mail/MissingSongRequest.php index c59fac7..f61d0e0 100644 --- a/app/Mail/MissingSongRequest.php +++ b/app/Mail/MissingSongRequest.php @@ -15,12 +15,11 @@ public function __construct( public string $songName, public ?string $ccliId, public mixed $service, - ) { - } + ) {} public function build() { return $this->subject("Song-Anfrage: {$this->songName} (CCLI: {$this->ccliId})") - ->view('emails.missing-song-request'); + ->view('emails.missing-song-request'); } } diff --git a/app/Models/ApiRequestLog.php b/app/Models/ApiRequestLog.php index b451d8f..1784b4d 100644 --- a/app/Models/ApiRequestLog.php +++ b/app/Models/ApiRequestLog.php @@ -52,7 +52,7 @@ public function scopeSearch(Builder $query, ?string $search): Builder return $query; } - $term = '%' . trim($search) . '%'; + $term = '%'.trim($search).'%'; return $query->where(function (Builder $builder) use ($term): void { $builder diff --git a/app/Models/Song.php b/app/Models/Song.php index bd0d33b..0ef5573 100644 --- a/app/Models/Song.php +++ b/app/Models/Song.php @@ -2,11 +2,11 @@ namespace App\Models; +use Illuminate\Database\Eloquent\Casts\Attribute; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\HasMany; use Illuminate\Database\Eloquent\SoftDeletes; -use Illuminate\Database\Eloquent\Casts\Attribute; class Song extends Model { diff --git a/app/Models/User.php b/app/Models/User.php index e4034b0..d836406 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -11,6 +11,7 @@ class User extends Authenticatable { /** @use HasFactory<\Database\Factories\UserFactory> */ use HasFactory; + use Notifiable; /** diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index f88fa51..f8936d4 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -2,9 +2,9 @@ namespace App\Providers; +use App\Socialite\ChurchToolsProvider; use Illuminate\Support\Facades\Vite; use Illuminate\Support\ServiceProvider; -use App\Socialite\ChurchToolsProvider; use Laravel\Socialite\Facades\Socialite; class AppServiceProvider extends ServiceProvider diff --git a/app/Services/ChurchToolsService.php b/app/Services/ChurchToolsService.php index f9f8469..ed0be51 100644 --- a/app/Services/ChurchToolsService.php +++ b/app/Services/ChurchToolsService.php @@ -3,11 +3,11 @@ namespace App\Services; use App\Models\ApiRequestLog; +use Closure; use CTApi\CTConfig; use CTApi\Models\Events\Event\EventAgendaRequest; use CTApi\Models\Events\Event\EventRequest; use CTApi\Models\Events\Song\SongRequest; -use Closure; use Illuminate\Support\Carbon; use Illuminate\Support\Facades\Config; use Illuminate\Support\Facades\DB; @@ -24,8 +24,7 @@ public function __construct( private readonly ?Closure $songFetcher = null, private readonly ?Closure $agendaFetcher = null, private readonly ?Closure $eventServiceFetcher = null, - ) { - } + ) {} public function sync(): array { @@ -252,7 +251,7 @@ private function summarizeResponse(mixed $result): ?string } if (is_array($result)) { - return 'Array mit ' . count($result) . ' Eintraegen'; + return 'Array mit '.count($result).' Eintraegen'; } if (is_scalar($result)) { @@ -260,7 +259,7 @@ private function summarizeResponse(mixed $result): ?string } if (is_object($result)) { - return 'Objekt vom Typ ' . $result::class; + return 'Objekt vom Typ '.$result::class; } return null; @@ -275,7 +274,7 @@ private function serializeResponseBody(mixed $result): ?string try { $json = json_encode($result, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_THROW_ON_ERROR); - return mb_strlen($json) > 512000 ? mb_substr($json, 0, 512000) . "\n... (abgeschnitten)" : $json; + return mb_strlen($json) > 512000 ? mb_substr($json, 0, 512000)."\n... (abgeschnitten)" : $json; } catch (\JsonException) { return null; } @@ -433,7 +432,7 @@ private function extractPersonName(mixed $eventService): ?string $firstName = method_exists($person, 'getFirstName') ? trim((string) $person->getFirstName()) : ''; $lastName = method_exists($person, 'getLastName') ? trim((string) $person->getLastName()) : ''; - $fullName = trim($firstName . ' ' . $lastName); + $fullName = trim($firstName.' '.$lastName); return $fullName === '' ? null : $fullName; } diff --git a/app/Services/FileConversionService.php b/app/Services/FileConversionService.php index 039d380..1f39ec0 100644 --- a/app/Services/FileConversionService.php +++ b/app/Services/FileConversionService.php @@ -34,8 +34,8 @@ public function convertImage(UploadedFile|string|SplFileInfo $file): array $this->assertSize($file, $sourcePath); - $filename = Str::uuid()->toString() . '.jpg'; - $relativePath = 'slides/' . $filename; + $filename = Str::uuid()->toString().'.jpg'; + $relativePath = 'slides/'.$filename; $targetPath = Storage::disk('public')->path($relativePath); Storage::disk('public')->makeDirectory('slides'); $this->ensureDirectory(dirname($targetPath)); @@ -85,12 +85,12 @@ public function processZip(UploadedFile|string|SplFileInfo $file): array $this->assertSize($file, $sourcePath); - $zip = new ZipArchive(); + $zip = new ZipArchive; if ($zip->open($sourcePath) !== true) { throw new InvalidArgumentException('ZIP-Datei konnte nicht geoeffnet werden.'); } - $extractDir = storage_path('app/temp/zip-' . Str::uuid()->toString()); + $extractDir = storage_path('app/temp/zip-'.Str::uuid()->toString()); if (! is_dir($extractDir) && ! mkdir($extractDir, 0775, true) && ! is_dir($extractDir)) { throw new InvalidArgumentException('Temporaires ZIP-Verzeichnis konnte nicht erstellt werden.'); } @@ -121,11 +121,13 @@ public function processZip(UploadedFile|string|SplFileInfo $file): array if (in_array($entryExtension, self::IMAGE_EXTENSIONS, true)) { $results[] = $this->convertImage($entryPath); + continue; } if (in_array($entryExtension, self::POWERPOINT_EXTENSIONS, true)) { $results[] = ['job_id' => $this->convertPowerPoint($entryPath)]; + continue; } @@ -147,8 +149,8 @@ public function generateThumbnail(string $path): string throw new InvalidArgumentException('Datei fuer Thumbnail nicht gefunden.'); } - $filename = pathinfo($absolutePath, PATHINFO_FILENAME) . '.jpg'; - $thumbnailRelativePath = 'slides/thumbnails/' . $filename; + $filename = pathinfo($absolutePath, PATHINFO_FILENAME).'.jpg'; + $thumbnailRelativePath = 'slides/thumbnails/'.$filename; $thumbnailAbsolutePath = Storage::disk('public')->path($thumbnailRelativePath); Storage::disk('public')->makeDirectory('slides/thumbnails'); $this->ensureDirectory(dirname($thumbnailAbsolutePath)); @@ -240,6 +242,7 @@ private function deleteDirectory(string $directory): void if ($item->isDir()) { @rmdir($item->getPathname()); + continue; } @@ -265,6 +268,6 @@ private function createImageManager(): mixed $managerClass = implode('\\', ['Intervention', 'Image', 'ImageManager']); $driverClass = implode('\\', ['Intervention', 'Image', 'Drivers', 'Gd', 'Driver']); - return new $managerClass(new $driverClass()); + return new $managerClass(new $driverClass); } } diff --git a/app/Services/ProImportService.php b/app/Services/ProImportService.php index 411ec39..978de56 100644 --- a/app/Services/ProImportService.php +++ b/app/Services/ProImportService.php @@ -6,7 +6,6 @@ use App\Models\SongArrangement; use App\Models\SongArrangementGroup; use App\Models\SongGroup; -use App\Models\SongSlide; use Illuminate\Http\UploadedFile; use Illuminate\Support\Facades\DB; use ProPresenter\Parser\ProFileReader; @@ -34,13 +33,13 @@ public function import(UploadedFile $file): array /** @return Song[] */ private function importZip(UploadedFile $file): array { - $zip = new ZipArchive(); + $zip = new ZipArchive; if ($zip->open($file->getRealPath()) !== true) { throw new \RuntimeException('ZIP-Datei konnte nicht geöffnet werden.'); } - $tempDir = sys_get_temp_dir() . '/pro-import-' . uniqid(); + $tempDir = sys_get_temp_dir().'/pro-import-'.uniqid(); mkdir($tempDir, 0755, true); $songs = []; @@ -49,8 +48,8 @@ private function importZip(UploadedFile $file): array $zip->extractTo($tempDir); $zip->close(); - $proFiles = glob($tempDir . '/*.pro') ?: []; - $proFilesNested = glob($tempDir . '/**/*.pro') ?: []; + $proFiles = glob($tempDir.'/*.pro') ?: []; + $proFilesNested = glob($tempDir.'/**/*.pro') ?: []; $allProFiles = array_unique(array_merge($proFiles, $proFilesNested)); if (empty($allProFiles)) { @@ -201,7 +200,7 @@ private function deleteDirectory(string $dir): void continue; } - $path = $dir . '/' . $item; + $path = $dir.'/'.$item; is_dir($path) ? $this->deleteDirectory($path) : unlink($path); } rmdir($dir); diff --git a/app/Socialite/ChurchToolsProvider.php b/app/Socialite/ChurchToolsProvider.php index ae91b6c..1031970 100644 --- a/app/Socialite/ChurchToolsProvider.php +++ b/app/Socialite/ChurchToolsProvider.php @@ -20,14 +20,14 @@ protected function getBaseUrl(): string protected function getAuthUrl($state): string { return $this->buildAuthUrlFromBase( - $this->getBaseUrl() . '/oauth/authorize', + $this->getBaseUrl().'/oauth/authorize', $state, ); } protected function getTokenUrl(): string { - return $this->getBaseUrl() . '/oauth/access_token'; + return $this->getBaseUrl().'/oauth/access_token'; } /** @@ -37,10 +37,10 @@ protected function getTokenUrl(): string protected function getUserByToken($token): array { $response = $this->getHttpClient()->get( - $this->getBaseUrl() . '/oauth/userinfo', + $this->getBaseUrl().'/oauth/userinfo', [ RequestOptions::HEADERS => [ - 'Authorization' => 'Bearer ' . $token, + 'Authorization' => 'Bearer '.$token, 'Accept' => 'application/json', ], ], @@ -51,9 +51,9 @@ protected function getUserByToken($token): array protected function mapUserToObject(array $user): User { - return (new User())->setRaw($user)->map([ + return (new User)->setRaw($user)->map([ 'id' => $user['id'] ?? null, - 'name' => $user['displayName'] ?? trim(($user['firstName'] ?? '') . ' ' . ($user['lastName'] ?? '')), + 'name' => $user['displayName'] ?? trim(($user['firstName'] ?? '').' '.($user['lastName'] ?? '')), 'email' => $user['email'] ?? null, 'avatar' => $user['imageUrl'] ?? null, ]); diff --git a/bootstrap/app.php b/bootstrap/app.php index f470853..ba1536b 100644 --- a/bootstrap/app.php +++ b/bootstrap/app.php @@ -1,9 +1,9 @@ withRouting( diff --git a/database/factories/SlideFactory.php b/database/factories/SlideFactory.php index 532d27b..de4f86d 100644 --- a/database/factories/SlideFactory.php +++ b/database/factories/SlideFactory.php @@ -15,9 +15,9 @@ public function definition(): array return [ 'type' => $this->faker->randomElement(['information', 'moderation', 'sermon']), 'service_id' => Service::factory(), - 'original_filename' => $this->faker->word() . '.jpg', - 'stored_filename' => $this->faker->uuid() . '.jpg', - 'thumbnail_filename' => $this->faker->uuid() . '_thumb.jpg', + 'original_filename' => $this->faker->word().'.jpg', + 'stored_filename' => $this->faker->uuid().'.jpg', + 'thumbnail_filename' => $this->faker->uuid().'_thumb.jpg', 'expire_date' => $this->faker->optional()->dateTimeBetween('now', '+12 months'), 'uploader_name' => $this->faker->name(), 'uploaded_at' => $this->faker->dateTimeBetween('-1 month', 'now'), diff --git a/database/migrations/2026_03_01_100000_extend_users_table.php b/database/migrations/2026_03_01_100000_extend_users_table.php index 5f1ce17..7306736 100644 --- a/database/migrations/2026_03_01_100000_extend_users_table.php +++ b/database/migrations/2026_03_01_100000_extend_users_table.php @@ -4,7 +4,8 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -return new class () extends Migration { +return new class extends Migration +{ public function up(): void { Schema::table('users', function (Blueprint $table) { diff --git a/database/migrations/2026_03_01_100100_create_services_table.php b/database/migrations/2026_03_01_100100_create_services_table.php index ca3d939..c05f46f 100644 --- a/database/migrations/2026_03_01_100100_create_services_table.php +++ b/database/migrations/2026_03_01_100100_create_services_table.php @@ -4,7 +4,8 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -return new class () extends Migration { +return new class extends Migration +{ public function up(): void { Schema::create('services', function (Blueprint $table) { diff --git a/database/migrations/2026_03_01_100200_create_songs_table.php b/database/migrations/2026_03_01_100200_create_songs_table.php index 8d6bd4e..9b2389c 100644 --- a/database/migrations/2026_03_01_100200_create_songs_table.php +++ b/database/migrations/2026_03_01_100200_create_songs_table.php @@ -4,7 +4,8 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -return new class () extends Migration { +return new class extends Migration +{ public function up(): void { Schema::create('songs', function (Blueprint $table) { diff --git a/database/migrations/2026_03_01_100300_create_song_groups_table.php b/database/migrations/2026_03_01_100300_create_song_groups_table.php index 3bde7f5..02702a6 100644 --- a/database/migrations/2026_03_01_100300_create_song_groups_table.php +++ b/database/migrations/2026_03_01_100300_create_song_groups_table.php @@ -4,7 +4,8 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -return new class () extends Migration { +return new class extends Migration +{ public function up(): void { Schema::create('song_groups', function (Blueprint $table) { diff --git a/database/migrations/2026_03_01_100400_create_song_slides_table.php b/database/migrations/2026_03_01_100400_create_song_slides_table.php index e01d5da..1d06a89 100644 --- a/database/migrations/2026_03_01_100400_create_song_slides_table.php +++ b/database/migrations/2026_03_01_100400_create_song_slides_table.php @@ -4,7 +4,8 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -return new class () extends Migration { +return new class extends Migration +{ public function up(): void { Schema::create('song_slides', function (Blueprint $table) { diff --git a/database/migrations/2026_03_01_100500_create_song_arrangements_table.php b/database/migrations/2026_03_01_100500_create_song_arrangements_table.php index a5c7187..2ed9c4a 100644 --- a/database/migrations/2026_03_01_100500_create_song_arrangements_table.php +++ b/database/migrations/2026_03_01_100500_create_song_arrangements_table.php @@ -4,7 +4,8 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -return new class () extends Migration { +return new class extends Migration +{ public function up(): void { Schema::create('song_arrangements', function (Blueprint $table) { diff --git a/database/migrations/2026_03_01_100600_create_song_arrangement_groups_table.php b/database/migrations/2026_03_01_100600_create_song_arrangement_groups_table.php index d1daaa4..bc760fa 100644 --- a/database/migrations/2026_03_01_100600_create_song_arrangement_groups_table.php +++ b/database/migrations/2026_03_01_100600_create_song_arrangement_groups_table.php @@ -4,7 +4,8 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -return new class () extends Migration { +return new class extends Migration +{ public function up(): void { Schema::create('song_arrangement_groups', function (Blueprint $table) { diff --git a/database/migrations/2026_03_01_100700_create_service_songs_table.php b/database/migrations/2026_03_01_100700_create_service_songs_table.php index 6103e08..da70473 100644 --- a/database/migrations/2026_03_01_100700_create_service_songs_table.php +++ b/database/migrations/2026_03_01_100700_create_service_songs_table.php @@ -4,7 +4,8 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -return new class () extends Migration { +return new class extends Migration +{ public function up(): void { Schema::create('service_songs', function (Blueprint $table) { diff --git a/database/migrations/2026_03_01_100800_create_slides_table.php b/database/migrations/2026_03_01_100800_create_slides_table.php index 1008ad1..74618a1 100644 --- a/database/migrations/2026_03_01_100800_create_slides_table.php +++ b/database/migrations/2026_03_01_100800_create_slides_table.php @@ -4,7 +4,8 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -return new class () extends Migration { +return new class extends Migration +{ public function up(): void { Schema::create('slides', function (Blueprint $table) { diff --git a/database/migrations/2026_03_01_100900_create_cts_sync_log_table.php b/database/migrations/2026_03_01_100900_create_cts_sync_log_table.php index 93f8569..8285846 100644 --- a/database/migrations/2026_03_01_100900_create_cts_sync_log_table.php +++ b/database/migrations/2026_03_01_100900_create_cts_sync_log_table.php @@ -4,7 +4,8 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -return new class () extends Migration { +return new class extends Migration +{ public function up(): void { Schema::create('cts_sync_log', function (Blueprint $table) { diff --git a/database/migrations/2026_03_02_100000_create_api_request_logs_table.php b/database/migrations/2026_03_02_100000_create_api_request_logs_table.php index a23bb5f..d3bd01c 100644 --- a/database/migrations/2026_03_02_100000_create_api_request_logs_table.php +++ b/database/migrations/2026_03_02_100000_create_api_request_logs_table.php @@ -4,7 +4,8 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -return new class () extends Migration { +return new class extends Migration +{ public function up(): void { Schema::create('api_request_logs', function (Blueprint $table) { diff --git a/database/migrations/2026_03_02_121522_add_response_body_to_api_request_logs_table.php b/database/migrations/2026_03_02_121522_add_response_body_to_api_request_logs_table.php index 84dfcfa..455143d 100644 --- a/database/migrations/2026_03_02_121522_add_response_body_to_api_request_logs_table.php +++ b/database/migrations/2026_03_02_121522_add_response_body_to_api_request_logs_table.php @@ -4,7 +4,8 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -return new class () extends Migration { +return new class extends Migration +{ /** * Run the migrations. */ diff --git a/database/migrations/2026_03_02_130249_add_cts_song_id_to_songs_and_service_songs_tables.php b/database/migrations/2026_03_02_130249_add_cts_song_id_to_songs_and_service_songs_tables.php index 3f4720c..fda6ffa 100644 --- a/database/migrations/2026_03_02_130249_add_cts_song_id_to_songs_and_service_songs_tables.php +++ b/database/migrations/2026_03_02_130249_add_cts_song_id_to_songs_and_service_songs_tables.php @@ -4,7 +4,8 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -return new class () extends Migration { +return new class extends Migration +{ public function up(): void { Schema::table('songs', function (Blueprint $table) { diff --git a/routes/api.php b/routes/api.php index 4f43978..08caf14 100644 --- a/routes/api.php +++ b/routes/api.php @@ -19,7 +19,6 @@ Route::middleware('auth:sanctum')->group(function () { Route::apiResource('songs', SongController::class)->names('api.songs'); - Route::post('/service-songs/{serviceSongId}/assign', [ServiceSongController::class, 'assignSong']) ->name('api.service-songs.assign'); diff --git a/src/Cts/CtsApiSpikeSync.php b/src/Cts/CtsApiSpikeSync.php index 3b510af..bfc475a 100644 --- a/src/Cts/CtsApiSpikeSync.php +++ b/src/Cts/CtsApiSpikeSync.php @@ -50,7 +50,7 @@ public static function run( try { $events = EventRequest::where('from', $fromDate)->get(); - $songResponse = CTClient::getClient()->get('/api/songs/' . $songId); + $songResponse = CTClient::getClient()->get('/api/songs/'.$songId); $songRaw = CTResponseUtil::dataAsArray($songResponse); $song = Song::createModelFromData($songRaw); } catch (Throwable $throwable) { diff --git a/tests/Feature/ChurchToolsSyncTest.php b/tests/Feature/ChurchToolsSyncTest.php index b7871cf..3e42bad 100644 --- a/tests/Feature/ChurchToolsSyncTest.php +++ b/tests/Feature/ChurchToolsSyncTest.php @@ -1,11 +1,11 @@ 'text', 'cclid' => '7115744', 'lyricParts' => [ - ['key' => 'v1', 'text' => "Du bist hier"], + ['key' => 'v1', 'text' => 'Du bist hier'], ], ], ], diff --git a/tests/Feature/InformationBlockTest.php b/tests/Feature/InformationBlockTest.php index 74e182f..ce0b4dd 100644 --- a/tests/Feature/InformationBlockTest.php +++ b/tests/Feature/InformationBlockTest.php @@ -41,9 +41,9 @@ $response->assertOk(); $response->assertInertia( fn ($page) => $page - ->component('Services/Edit') - ->has('informationSlides', 1) - ->where('informationSlides.0.id', $validSlide->id) + ->component('Services/Edit') + ->has('informationSlides', 1) + ->where('informationSlides.0.id', $validSlide->id) ); }); @@ -71,8 +71,8 @@ $response->assertOk(); $response->assertInertia( fn ($page) => $page - ->has('informationSlides', 1) - ->where('informationSlides.0.id', $sameDay->id) + ->has('informationSlides', 1) + ->where('informationSlides.0.id', $sameDay->id) ); }); @@ -101,7 +101,7 @@ $responseA->assertOk(); $responseA->assertInertia( fn ($page) => $page - ->has('informationSlides', 2) + ->has('informationSlides', 2) ); // Service B: only slideLate should appear (slideEarly expire_date < 2026-03-20) @@ -109,8 +109,8 @@ $responseB->assertOk(); $responseB->assertInertia( fn ($page) => $page - ->has('informationSlides', 1) - ->where('informationSlides.0.id', $slideLate->id) + ->has('informationSlides', 1) + ->where('informationSlides.0.id', $slideLate->id) ); }); @@ -139,8 +139,8 @@ $response->assertOk(); $response->assertInertia( fn ($page) => $page - ->has('informationSlides', 1) - ->where('informationSlides.0.id', $activeSlide->id) + ->has('informationSlides', 1) + ->where('informationSlides.0.id', $activeSlide->id) ); }); @@ -173,8 +173,8 @@ $response->assertOk(); $response->assertInertia( fn ($page) => $page - ->has('informationSlides', 1) - ->where('informationSlides.0.id', $infoSlide->id) + ->has('informationSlides', 1) + ->where('informationSlides.0.id', $infoSlide->id) ); }); @@ -203,9 +203,9 @@ $response->assertOk(); $response->assertInertia( fn ($page) => $page - ->has('informationSlides', 2) - ->where('informationSlides.0.id', $withoutExpire->id) - ->where('informationSlides.1.id', $withExpire->id) + ->has('informationSlides', 2) + ->where('informationSlides.0.id', $withoutExpire->id) + ->where('informationSlides.1.id', $withExpire->id) ); }); @@ -233,8 +233,8 @@ $response->assertOk(); $response->assertInertia( fn ($page) => $page - ->has('informationSlides', 1) - ->where('informationSlides.0.id', $visibleSlide->id) + ->has('informationSlides', 1) + ->where('informationSlides.0.id', $visibleSlide->id) ); }); @@ -262,8 +262,8 @@ $response->assertOk(); $response->assertInertia( fn ($page) => $page - ->has('informationSlides', 2) - ->where('informationSlides.0.id', $newer->id) - ->where('informationSlides.1.id', $older->id) + ->has('informationSlides', 2) + ->where('informationSlides.0.id', $newer->id) + ->where('informationSlides.1.id', $older->id) ); }); diff --git a/tests/Feature/MissingSongMailTest.php b/tests/Feature/MissingSongMailTest.php index 19887b3..febe9ab 100644 --- a/tests/Feature/MissingSongMailTest.php +++ b/tests/Feature/MissingSongMailTest.php @@ -3,7 +3,6 @@ namespace Tests\Feature; use App\Mail\MissingSongRequest; -use Illuminate\Support\Facades\Mail; use Illuminate\Support\Facades\Route; use Tests\TestCase; @@ -28,7 +27,7 @@ public function test_missing_song_request_mailable_renders_with_german_content() $serviceDate = '2026-03-08'; // Create a mock service object - $service = new \stdClass(); + $service = new \stdClass; $service->id = $serviceId; $service->title = $serviceTitle; $service->date = $serviceDate; @@ -55,7 +54,7 @@ public function test_missing_song_request_mailable_has_correct_subject(): void $songName = 'Großer Gott'; $ccliId = '12345678'; - $service = new \stdClass(); + $service = new \stdClass; $service->id = 1; $service->title = 'Sonntagsgottesdienst'; $service->date = '2026-03-08'; diff --git a/tests/Feature/OAuthTest.php b/tests/Feature/OAuthTest.php index 4015b3f..3db0385 100644 --- a/tests/Feature/OAuthTest.php +++ b/tests/Feature/OAuthTest.php @@ -16,7 +16,7 @@ $response->assertStatus(200); $response->assertInertia( fn ($page) => $page - ->component('Auth/Login') + ->component('Auth/Login') ); }); @@ -28,7 +28,7 @@ // This is verified by checking the component renders correctly $response->assertInertia( fn ($page) => $page - ->component('Auth/Login') + ->component('Auth/Login') ); }); @@ -50,7 +50,7 @@ }); it('creates a new user from OAuth callback', function () { - $socialiteUser = new SocialiteUser(); + $socialiteUser = new SocialiteUser; $socialiteUser->map([ 'id' => '42', 'name' => 'Max Mustermann', @@ -104,7 +104,7 @@ 'churchtools_id' => 42, ]); - $socialiteUser = new SocialiteUser(); + $socialiteUser = new SocialiteUser; $socialiteUser->map([ 'id' => '42', 'name' => 'Max Mustermann', diff --git a/tests/Feature/ProFileImportTest.php b/tests/Feature/ProFileImportTest.php index 800a0c6..620c691 100644 --- a/tests/Feature/ProFileImportTest.php +++ b/tests/Feature/ProFileImportTest.php @@ -12,7 +12,7 @@ final class ProFileImportTest extends TestCase { use RefreshDatabase; - private function testProFile(): UploadedFile + private function test_pro_file(): UploadedFile { $sourcePath = base_path('../propresenter-work/ref/Test.pro'); @@ -24,7 +24,7 @@ public function test_import_pro_datei_erstellt_song_mit_gruppen_und_slides(): vo $user = User::factory()->create(); $response = $this->actingAs($user)->postJson(route('api.songs.import-pro'), [ - 'file' => $this->testProFile(), + 'file' => $this->test_pro_file(), ]); $response->assertOk(); @@ -43,13 +43,13 @@ public function test_import_pro_ohne_ccli_erstellt_neuen_song(): void $user = User::factory()->create(); $this->actingAs($user)->postJson(route('api.songs.import-pro'), [ - 'file' => $this->testProFile(), + 'file' => $this->test_pro_file(), ]); $this->assertSame(1, Song::count()); $this->actingAs($user)->postJson(route('api.songs.import-pro'), [ - 'file' => $this->testProFile(), + 'file' => $this->test_pro_file(), ]); $this->assertSame(2, Song::count()); @@ -71,7 +71,7 @@ public function test_import_pro_upsert_mit_ccli_dupliziert_nicht(): void $this->assertSame(1, Song::count()); $response = $this->actingAs($user)->postJson(route('api.songs.import-pro'), [ - 'file' => $this->testProFile(), + 'file' => $this->test_pro_file(), ]); $response->assertOk(); @@ -94,7 +94,7 @@ public function test_import_pro_lehnt_ungueltige_datei_ab(): void public function test_import_pro_erfordert_authentifizierung(): void { $response = $this->postJson(route('api.songs.import-pro'), [ - 'file' => $this->testProFile(), + 'file' => $this->test_pro_file(), ]); $response->assertUnauthorized(); @@ -105,7 +105,7 @@ public function test_import_pro_erstellt_arrangement_gruppen(): void $user = User::factory()->create(); $this->actingAs($user)->postJson(route('api.songs.import-pro'), [ - 'file' => $this->testProFile(), + 'file' => $this->test_pro_file(), ]); $song = Song::where('title', 'Test')->first(); diff --git a/tests/Feature/SharedPropsTest.php b/tests/Feature/SharedPropsTest.php index 9c235d7..33c78f4 100644 --- a/tests/Feature/SharedPropsTest.php +++ b/tests/Feature/SharedPropsTest.php @@ -15,13 +15,13 @@ $response->assertOk(); $response->assertInertia( fn ($page) => $page - ->has('auth.user') - ->where('auth.user.id', $user->id) - ->where('auth.user.name', 'Max Mustermann') - ->where('auth.user.email', 'max@example.de') - ->where('auth.user.avatar', 'https://example.de/avatar.jpg') - ->missing('auth.user.password') - ->missing('auth.user.remember_token') + ->has('auth.user') + ->where('auth.user.id', $user->id) + ->where('auth.user.name', 'Max Mustermann') + ->where('auth.user.email', 'max@example.de') + ->where('auth.user.avatar', 'https://example.de/avatar.jpg') + ->missing('auth.user.password') + ->missing('auth.user.remember_token') ); }); @@ -32,7 +32,7 @@ $response->assertOk(); $response->assertInertia( fn ($page) => $page - ->where('auth.user', null) + ->where('auth.user', null) ); }); @@ -46,8 +46,8 @@ $response->assertOk(); $response->assertInertia( fn ($page) => $page - ->has('flash') - ->where('flash.success', 'Erfolgreich gespeichert!') + ->has('flash') + ->where('flash.success', 'Erfolgreich gespeichert!') ); }); @@ -61,8 +61,8 @@ $response->assertOk(); $response->assertInertia( fn ($page) => $page - ->has('flash') - ->where('flash.error', 'Ein Fehler ist aufgetreten.') + ->has('flash') + ->where('flash.error', 'Ein Fehler ist aufgetreten.') ); }); @@ -90,8 +90,8 @@ $response->assertOk(); $response->assertInertia( fn ($page) => $page - ->has('last_synced_at') - ->where('last_synced_at', $syncTime->toJSON()) + ->has('last_synced_at') + ->where('last_synced_at', $syncTime->toJSON()) ); }); @@ -103,7 +103,7 @@ $response->assertOk(); $response->assertInertia( fn ($page) => $page - ->where('last_synced_at', null) + ->where('last_synced_at', null) ); }); @@ -115,6 +115,6 @@ $response->assertOk(); $response->assertInertia( fn ($page) => $page - ->has('app_name') + ->has('app_name') ); }); diff --git a/tests/Feature/SlideControllerTest.php b/tests/Feature/SlideControllerTest.php index fa47369..906b7ce 100644 --- a/tests/Feature/SlideControllerTest.php +++ b/tests/Feature/SlideControllerTest.php @@ -115,7 +115,7 @@ // Create a real file with .pptx extension $tempPath = tempnam(sys_get_temp_dir(), 'cts-pptx-'); - $pptxPath = $tempPath . '.pptx'; + $pptxPath = $tempPath.'.pptx'; file_put_contents($pptxPath, str_repeat('x', 1024)); $file = new UploadedFile($pptxPath, 'slides.pptx', 'application/vnd.openxmlformats-officedocument.presentationml.presentation', null, true); @@ -136,11 +136,11 @@ test('upload zip processes contained images', function () { // Create a small zip with a valid image - $tempDir = sys_get_temp_dir() . '/cts-zip-test-' . uniqid(); + $tempDir = sys_get_temp_dir().'/cts-zip-test-'.uniqid(); mkdir($tempDir, 0775, true); // Create an image inside - $imgPath = $tempDir . '/slide1.png'; + $imgPath = $tempDir.'/slide1.png'; $image = imagecreatetruecolor(200, 150); $blue = imagecolorallocate($image, 0, 0, 255); imagefill($image, 0, 0, $blue); @@ -148,8 +148,8 @@ imagedestroy($image); // Build zip - $zipPath = $tempDir . '/slides.zip'; - $zip = new ZipArchive(); + $zipPath = $tempDir.'/slides.zip'; + $zip = new ZipArchive; $zip->open($zipPath, ZipArchive::CREATE); $zip->addFile($imgPath, 'slide1.png'); $zip->close(); diff --git a/tests/Feature/SongMatchingTest.php b/tests/Feature/SongMatchingTest.php index 901d7a7..48fc5bc 100644 --- a/tests/Feature/SongMatchingTest.php +++ b/tests/Feature/SongMatchingTest.php @@ -1,7 +1,6 @@ assertOk(); $response->assertInertia( fn ($page) => $page - ->component('Services/Edit') - ->has('serviceSongs', 2) - ->where('serviceSongs.0.cts_song_name', 'First Song') - ->where('serviceSongs.0.song_id', null) - ->where('serviceSongs.1.cts_song_name', 'Unmatched Song') - ->where('serviceSongs.1.song_id', null) - ->has('songsCatalog') - ->where('songsCatalog', fn ($songsCatalog) => collect($songsCatalog)->contains( - fn (array $song) => $song['title'] === 'Amazing Grace' && $song['ccli_id'] === '22025' - )) + ->component('Services/Edit') + ->has('serviceSongs', 2) + ->where('serviceSongs.0.cts_song_name', 'First Song') + ->where('serviceSongs.0.song_id', null) + ->where('serviceSongs.1.cts_song_name', 'Unmatched Song') + ->where('serviceSongs.1.song_id', null) + ->has('songsCatalog') + ->where('songsCatalog', fn ($songsCatalog) => collect($songsCatalog)->contains( + fn (array $song) => $song['title'] === 'Amazing Grace' && $song['ccli_id'] === '22025' + )) ); } @@ -128,13 +128,13 @@ public function test_songs_block_provides_matched_song_data_for_arrangement_conf $response->assertOk(); $response->assertInertia( fn ($page) => $page - ->component('Services/Edit') - ->where('serviceSongs.0.song_id', $song->id) - ->where('serviceSongs.0.song.has_translation', true) - ->where('serviceSongs.0.song.arrangements.0.name', 'Normal') - ->where('serviceSongs.0.song.arrangements.0.groups.0.name', 'Strophe 1') - ->where('serviceSongs.0.song.groups.0.name', 'Strophe 1') - ->where('serviceSongs.0.song_arrangement_id', $normal->id) + ->component('Services/Edit') + ->where('serviceSongs.0.song_id', $song->id) + ->where('serviceSongs.0.song.has_translation', true) + ->where('serviceSongs.0.song.arrangements.0.name', 'Normal') + ->where('serviceSongs.0.song.arrangements.0.groups.0.name', 'Strophe 1') + ->where('serviceSongs.0.song.groups.0.name', 'Strophe 1') + ->where('serviceSongs.0.song_arrangement_id', $normal->id) ); } } diff --git a/tests/Feature/SyncControllerTest.php b/tests/Feature/SyncControllerTest.php index b98640d..ba63fa8 100644 --- a/tests/Feature/SyncControllerTest.php +++ b/tests/Feature/SyncControllerTest.php @@ -1,9 +1,8 @@ create([ 'song_group_id' => $group->id, 'order' => 1, - 'text_content' => "Line 1", + 'text_content' => 'Line 1', ]); - $this->service->importTranslation($song, "Zeile 1"); + $this->service->importTranslation($song, 'Zeile 1'); $song->refresh(); expect($song->has_translation)->toBeTrue(); @@ -229,15 +229,15 @@ $slide1 = SongSlide::factory()->create([ 'song_group_id' => $group->id, 'order' => 1, - 'text_content' => "Original", - 'text_content_translated' => "Übersetzt", + 'text_content' => 'Original', + 'text_content_translated' => 'Übersetzt', ]); $slide2 = SongSlide::factory()->create([ 'song_group_id' => $group->id, 'order' => 2, - 'text_content' => "Original 2", - 'text_content_translated' => "Übersetzt 2", + 'text_content' => 'Original 2', + 'text_content_translated' => 'Übersetzt 2', ]); $this->service->removeTranslation($song); @@ -350,8 +350,8 @@ SongSlide::factory()->create([ 'song_group_id' => $group->id, 'order' => 1, - 'text_content' => "Original", - 'text_content_translated' => "Übersetzt", + 'text_content' => 'Original', + 'text_content_translated' => 'Übersetzt', ]); $response = $this->actingAs($this->user)