- 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.
70 lines
2.2 KiB
PHP
70 lines
2.2 KiB
PHP
<?php
|
|
|
|
use Illuminate\Database\Migrations\Migration;
|
|
use Illuminate\Database\Schema\Blueprint;
|
|
use Illuminate\Support\Facades\DB;
|
|
use Illuminate\Support\Facades\Schema;
|
|
use Illuminate\Support\Str;
|
|
|
|
return new class extends Migration
|
|
{
|
|
/**
|
|
* Run the migrations.
|
|
*/
|
|
public function up(): void
|
|
{
|
|
Schema::create('galleries', function (Blueprint $table) {
|
|
$table->id();
|
|
$table->string('name');
|
|
$table->string('slug')->unique();
|
|
$table->string('title');
|
|
$table->string('images_path')->default('uploads');
|
|
$table->boolean('is_public')->default(true);
|
|
$table->boolean('allow_ai_styles')->default(true);
|
|
$table->boolean('allow_print')->default(true);
|
|
$table->boolean('require_password')->default(false);
|
|
$table->string('password_hash')->nullable();
|
|
$table->timestamp('expires_at')->nullable();
|
|
$table->unsignedInteger('access_duration_minutes')->nullable();
|
|
$table->timestamps();
|
|
});
|
|
|
|
$defaultGalleryId = DB::table('galleries')->insertGetId([
|
|
'name' => 'Default Gallery',
|
|
'slug' => Str::uuid()->toString(),
|
|
'title' => 'Style Gallery',
|
|
'images_path' => 'uploads',
|
|
'is_public' => true,
|
|
'allow_ai_styles' => true,
|
|
'allow_print' => true,
|
|
'require_password' => false,
|
|
'password_hash' => null,
|
|
'expires_at' => null,
|
|
'access_duration_minutes' => null,
|
|
'created_at' => now(),
|
|
'updated_at' => now(),
|
|
]);
|
|
|
|
Schema::table('images', function (Blueprint $table) use ($defaultGalleryId): void {
|
|
$table->foreignId('gallery_id')
|
|
->after('id')
|
|
->default($defaultGalleryId)
|
|
->constrained();
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Reverse the migrations.
|
|
*/
|
|
public function down(): void
|
|
{
|
|
Schema::table('images', function (Blueprint $table): void {
|
|
if (Schema::hasColumn('images', 'gallery_id')) {
|
|
$table->dropConstrainedForeignId('gallery_id');
|
|
}
|
|
});
|
|
|
|
Schema::dropIfExists('galleries');
|
|
}
|
|
};
|