pp-planer/app/Http/Controllers/ExportProFileController.php
Thorsten Bus d5f3990f3b fix: login redirect, nametag/worship resolution, macros, export headers & probundle
- Post-login (OAuth + dev-login) now redirects to the next upcoming
  service's edit page instead of /dashboard, mirroring the GET / route.
- NameTagResolver now reads the real ChurchTools `responsible` shape
  (persons[].person.title) and resolves moderator/preacher/worship-leader
  by responsible ROLE ([Moderation]/[Predigt]/[Lobpreis]). This fixes
  missing name slides and makes the worship-leader arrangement trigger
  (e.g. service 12 → "Benedikt Hardt" / "Jennifer Schneider").
- NameTagSlideBuilder no longer silently drops the name slide when the
  configured macro id points to a missing macro; it emits the slide
  without a macro instead.
- Song export: the "first slide" / "last slide" macro now applies only to
  the song's very first/last slide (global slide index across all
  sections), not the first slide of every section.
- Export "headlines" for content-less agenda items are now emitted as
  proper ProPresenter playlist HEADER items instead of text presentations.
- Prefix/postfix export files now also accept .probundle (unzipped: inner
  .pro + media embedded) in addition to .pro, both for upload validation
  and export injection.

Full suite green (587 passed).
2026-06-01 22:17:31 +02:00

60 lines
1.8 KiB
PHP

<?php
namespace App\Http\Controllers;
use App\Models\ExportProFile;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Storage;
use Illuminate\Validation\Rule;
class ExportProFileController extends Controller
{
public function store(Request $request): JsonResponse
{
$request->validate([
'type' => ['required', Rule::in(['prefix', 'postfix'])],
'files' => ['required', 'array'],
'files.*' => ['required', 'file', 'max:10240', 'extensions:pro,probundle'],
], [
'files.*.extensions' => 'Nur .pro- und .probundle-Dateien sind erlaubt.',
]);
$type = $request->input('type');
$created = [];
foreach ($request->file('files') as $file) {
$storedPath = $file->store('export-pro-files/'.$type, 'local');
$maxOrder = ExportProFile::where('type', $type)->max('order') ?? 0;
$record = ExportProFile::create([
'type' => $type,
'original_name' => $file->getClientOriginalName(),
'stored_path' => $storedPath,
'order' => $maxOrder + 1,
]);
$created[] = [
'id' => $record->id,
'original_name' => $record->original_name,
'order' => $record->order,
];
}
return response()->json([
'files' => $created,
'message' => count($created).' Datei(en) erfolgreich hochgeladen.',
], 201);
}
public function destroy(ExportProFile $exportProFile): JsonResponse
{
Storage::disk('local')->delete($exportProFile->stored_path);
$exportProFile->delete();
return response()->json([
'message' => 'Datei erfolgreich gelöscht.',
]);
}
}