- 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:
63
app/Models/Gallery.php
Normal file
63
app/Models/Gallery.php
Normal file
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
|
||||
class Gallery extends Model
|
||||
{
|
||||
/** @use HasFactory<\Database\Factories\GalleryFactory> */
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable = [
|
||||
'name',
|
||||
'slug',
|
||||
'title',
|
||||
'images_path',
|
||||
'is_public',
|
||||
'allow_ai_styles',
|
||||
'allow_print',
|
||||
'require_password',
|
||||
'password_hash',
|
||||
'expires_at',
|
||||
'access_duration_minutes',
|
||||
'upload_enabled',
|
||||
'upload_token_hash',
|
||||
'upload_token_expires_at',
|
||||
];
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'is_public' => 'bool',
|
||||
'allow_ai_styles' => 'bool',
|
||||
'allow_print' => 'bool',
|
||||
'require_password' => 'bool',
|
||||
'expires_at' => 'datetime',
|
||||
'access_duration_minutes' => 'int',
|
||||
'upload_enabled' => 'bool',
|
||||
'upload_token_expires_at' => 'datetime',
|
||||
];
|
||||
}
|
||||
|
||||
public function images(): HasMany
|
||||
{
|
||||
return $this->hasMany(Image::class);
|
||||
}
|
||||
|
||||
public function setUploadToken(string $token): void
|
||||
{
|
||||
$this->upload_token_hash = \Illuminate\Support\Facades\Hash::make($token);
|
||||
}
|
||||
|
||||
public function regenerateUploadToken(): string
|
||||
{
|
||||
$token = \Illuminate\Support\Str::random(40);
|
||||
$this->setUploadToken($token);
|
||||
$this->save();
|
||||
|
||||
return $token;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user