Phase 8 (Rest) + Umbauten vom 10./11.06.: - Ein Titelbild pro PM (Cover 1280x580), SVG-Platzhalter-Set + Picker, PressReleaseCoverImage-Resolver - Lizenz-/Rechteformular nach "Lizenztyp Bildupload" (7 Lizenztypen, Personen-/Sachrechte-Status, bedingte Pflichtfelder, Risikohinweise) - Veroeffentlichungs-Box vereinfacht (Embargo aus der Form-UI entfernt), geplante Termine in Europe/Berlin (Speicherung UTC, DISPLAY_TIMEZONE) - Quota-Stub (users.press_release_quota) + monatlicher Reset-Command - Einreichungs-Modal einheitlich in Show/Create/Edit; Ghost-Buttons auf filled; PM-Editor-Layout responsive entkoppelt (.pr-editor-layout) KI-Pruef-Pipeline (Phasen 1-5 des Entwicklungsplans): - API-Haertung: status nicht mehr per API setzbar, eigene Submit-Route durch denselben Funnel (Blacklist, Quota, Status-Log) - Klassifikation Rot/Gelb/Gruen asynchron (Queue classification, OpenAI-Treiber + deterministischer Fallback), ki_audits-Audit-Log - Routing: Rot -> rejected + Mail, Gelb -> Review-Queue, Gruen -> Auto-Publish; Scheduler publiziert nur gruene faellige PMs - Content-Score 0-100 -> Stufe (Standard/Geprueft/Hochwertig) inkl. Editor-Panel und Badges; Re-Klassifikation/-Score bei Aenderung - Admin: KI-Badge + Filter, On-Demand-Pruefung mit Anbieter-Override Suite: 442 passed, 4 skipped. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
100 lines
2.3 KiB
PHP
100 lines
2.3 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use App\Enums\ImageLicenseType;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
use Illuminate\Support\Facades\Storage;
|
|
|
|
class PressReleaseImage extends Model
|
|
{
|
|
use SoftDeletes;
|
|
|
|
protected $fillable = [
|
|
'press_release_id',
|
|
'disk',
|
|
'path',
|
|
'variants',
|
|
'title',
|
|
'description',
|
|
'copyright',
|
|
'author',
|
|
'license_type',
|
|
'license_detail',
|
|
'license_url',
|
|
'source_url',
|
|
'persons_consent',
|
|
'people_rights_status',
|
|
'property_rights_status',
|
|
'rights_notes',
|
|
'rights_confirmed_at',
|
|
'is_preview',
|
|
'sort_order',
|
|
'width',
|
|
'height',
|
|
'mime',
|
|
'legacy_portal',
|
|
'legacy_id',
|
|
];
|
|
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'variants' => 'array',
|
|
'license_type' => ImageLicenseType::class,
|
|
'persons_consent' => 'boolean',
|
|
'rights_confirmed_at' => 'datetime',
|
|
'is_preview' => 'boolean',
|
|
'sort_order' => 'integer',
|
|
'width' => 'integer',
|
|
'height' => 'integer',
|
|
'deleted_at' => 'datetime',
|
|
];
|
|
}
|
|
|
|
public function pressRelease(): BelongsTo
|
|
{
|
|
return $this->belongsTo(PressRelease::class);
|
|
}
|
|
|
|
public function url(): ?string
|
|
{
|
|
if (blank($this->path)) {
|
|
return null;
|
|
}
|
|
|
|
return $this->resolveDiskUrl($this->path);
|
|
}
|
|
|
|
public function variantUrl(string $key): ?string
|
|
{
|
|
$variantPath = $this->variants[$key] ?? null;
|
|
|
|
if (! is_string($variantPath) || blank($variantPath)) {
|
|
return null;
|
|
}
|
|
|
|
return $this->resolveDiskUrl($variantPath);
|
|
}
|
|
|
|
private function resolveDiskUrl(string $relativePath): ?string
|
|
{
|
|
if ($this->disk === 'public') {
|
|
return asset('storage/'.ltrim($relativePath, '/'));
|
|
}
|
|
|
|
try {
|
|
$disk = Storage::disk($this->disk);
|
|
|
|
if (method_exists($disk, 'url')) {
|
|
return $disk->url($relativePath);
|
|
}
|
|
|
|
return null;
|
|
} catch (\Throwable) {
|
|
return null;
|
|
}
|
|
}
|
|
}
|