- Galerien sind nun eine Entität - es kann mehrere geben

- Neues Sparkbooth-Upload-Feature: Endpoint /api/sparkbooth/upload (Token-basiert pro Galerie), Controller Api/SparkboothUploadController, Migration 2026_01_21_000001_add_upload_fields_to_galleries_table.php mit Upload-Flags/Token/Expiry;
    Galerie-Modell und Factory/Seeder entsprechend erweitert.
  - Filament: Neue Setup-Seite SparkboothSetup (mit View) zur schnellen Galerie- und Token-Erstellung inkl. QR/Endpoint/Snippet;
    Galerie-Link-Views nutzen jetzt simple-qrcode (Composer-Dependency hinzugefügt) und bieten PNG-Download.
  - Galerie-Tabelle: Slug/Pfad-Spalten entfernt, Action „Link-Details“ mit Modal; Created-at-Spalte hinzugefügt.
  - Zugriffshärtung: Galerie-IDs in API (ImageController, Download/Print) geprüft; GalleryAccess/Middleware + Gallery-Modell/Slug-UUID
    eingeführt; GalleryAccess-Inertia-Seite.
  - UI/UX: LoadingSpinner/StyledImageDisplay verbessert, Delete-Confirm, Übersetzungen ergänzt.
This commit is contained in:
2025-12-04 07:52:50 +01:00
parent 52dc61ca16
commit f5da8ed877
49 changed files with 2243 additions and 165 deletions

View File

@@ -0,0 +1,86 @@
<?php
namespace App\Filament\Resources\Galleries;
use App\Filament\Resources\Galleries\Pages\CreateGallery;
use App\Filament\Resources\Galleries\Pages\EditGallery;
use App\Filament\Resources\Galleries\Pages\ListGalleries;
use App\Filament\Resources\Galleries\Schemas\GalleryForm;
use App\Filament\Resources\Galleries\Tables\GalleriesTable;
use App\Models\Gallery;
use BackedEnum;
use Filament\Resources\Resource;
use Filament\Schemas\Schema;
use Filament\Support\Icons\Heroicon;
use Filament\Tables\Table;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Str;
use UnitEnum;
class GalleryResource extends Resource
{
protected static ?string $model = Gallery::class;
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedRectangleStack;
protected static UnitEnum|string|null $navigationGroup = 'Content';
public static function getNavigationGroup(): ?string
{
return __('filament.navigation.groups.content');
}
public static function form(Schema $schema): Schema
{
return GalleryForm::configure($schema);
}
public static function table(Table $table): Table
{
return GalleriesTable::configure($table);
}
public static function getRelations(): array
{
return [
//
];
}
public static function getPages(): array
{
return [
'index' => ListGalleries::route('/'),
'create' => CreateGallery::route('/create'),
'edit' => EditGallery::route('/{record}/edit'),
];
}
public static function mutateFormDataBeforeCreate(array $data): array
{
$data = self::mutatePassword($data);
$data['slug'] = $data['slug'] ?: Str::uuid()->toString();
return $data;
}
public static function mutateFormDataBeforeSave(array $data): array
{
$data = self::mutatePassword($data);
$data['slug'] = $data['slug'] ?: Str::uuid()->toString();
return $data;
}
private static function mutatePassword(array $data): array
{
$password = $data['password'] ?? null;
unset($data['password']);
if (! empty($password)) {
$data['password_hash'] = Hash::make($password);
}
return $data;
}
}