Event-Thumbnails: Vorschaubilder mit Auto-Resize und Typ-Logos
- Migration: thumbnail-Spalte in events-Tabelle - Event-Model: imageUrl() liefert Custom-Thumbnail oder Standard-Logo je Event-Typ (Logo_Training.png, Logo_Heimspiel.png, etc.) - Thumbnail-Upload neben Typ-Auswahl bei Erstellen/Bearbeiten mit Live-Vorschau und Entfernen-Button - Automatische Skalierung auf max. FullHD (1920x1080) via GD und Speicherung als JPEG (Qualität 85) - Event-Listen (App + Admin): Logo/Thumbnail links im Terminblock - Übersetzungen in allen 6 Sprachen Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -36,6 +36,7 @@ class Event extends Model
|
||||
'opponent',
|
||||
'score_home',
|
||||
'score_away',
|
||||
'thumbnail',
|
||||
];
|
||||
|
||||
protected function casts(): array
|
||||
@@ -300,6 +301,27 @@ class Event extends Model
|
||||
return $query->where('team_id', $teamId);
|
||||
}
|
||||
|
||||
/**
|
||||
* URL zum Event-Bild: Custom-Thumbnail oder Standard-Logo nach Event-Typ.
|
||||
*/
|
||||
public function imageUrl(): string
|
||||
{
|
||||
if ($this->thumbnail) {
|
||||
return asset('storage/thumbnails/' . $this->thumbnail);
|
||||
}
|
||||
|
||||
$map = [
|
||||
'home_game' => 'Logo_Heimspiel.png',
|
||||
'away_game' => 'Logo_Auswärtsspiel.png',
|
||||
'training' => 'Logo_Training.png',
|
||||
'tournament' => 'Logo_Turnier.png',
|
||||
'meeting' => 'Logo_Besprechung.png',
|
||||
'other' => 'Logo_Sonstiges.png',
|
||||
];
|
||||
|
||||
return asset('images/' . ($map[$this->type->value] ?? 'Logo_Sonstiges.png'));
|
||||
}
|
||||
|
||||
public function isPartOfSeries(): bool
|
||||
{
|
||||
return $this->event_series_id !== null;
|
||||
|
||||
Reference in New Issue
Block a user