Display Module 13-05-2026
This commit is contained in:
parent
6a65354f4c
commit
9262132325
41 changed files with 496 additions and 334 deletions
|
|
@ -4,7 +4,6 @@ namespace App\Models;
|
|||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\Relations\HasOne;
|
||||
use Illuminate\Support\Str;
|
||||
|
|
@ -30,17 +29,6 @@ class Display extends Model
|
|||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Wird in Phase 7 entfernt. Nutze stattdessen liveModules()
|
||||
* oder die Playlist-Relationen (livePlaylist, draftPlaylist).
|
||||
*/
|
||||
public function versions(): BelongsToMany
|
||||
{
|
||||
return $this->belongsToMany(DisplayVersion::class, 'display_display_version')
|
||||
->withPivot('sort_order')
|
||||
->orderByPivot('sort_order');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return HasMany<DisplayPlaylist, $this>
|
||||
*/
|
||||
|
|
@ -67,29 +55,6 @@ class Display extends Model
|
|||
->where('status', DisplayPlaylist::STATUS_DRAFT);
|
||||
}
|
||||
|
||||
/**
|
||||
* Liefert die Module der aktuell veröffentlichten Bespielung in Reihenfolge.
|
||||
*/
|
||||
public function liveModules(): BelongsToMany
|
||||
{
|
||||
return $this->belongsToMany(
|
||||
DisplayVersion::class,
|
||||
'display_playlist_items',
|
||||
'display_playlist_id',
|
||||
'display_version_id'
|
||||
)
|
||||
->wherePivotIn(
|
||||
'display_playlist_id',
|
||||
DisplayPlaylist::query()
|
||||
->where('display_id', $this->id ?? 0)
|
||||
->where('status', DisplayPlaylist::STATUS_PUBLISHED)
|
||||
->select('id')
|
||||
)
|
||||
->withPivot(['sort_order', 'id'])
|
||||
->withTimestamps()
|
||||
->orderByPivot('sort_order');
|
||||
}
|
||||
|
||||
public function ensurePreviewToken(): string
|
||||
{
|
||||
if (! $this->preview_token) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue