devices = auth()->user()->devices()->with(['playlists.items.plugin'])->get(); return view('livewire.playlists.index'); } public function togglePlaylistActive(Playlist $playlist) { abort_unless(auth()->user()->devices->contains($playlist->device), 403); $playlist->update(['is_active' => !$playlist->is_active]); $this->devices = auth()->user()->devices()->with(['playlists.items.plugin'])->get(); } public function movePlaylistItemUp(PlaylistItem $item) { abort_unless(auth()->user()->devices->contains($item->playlist->device), 403); $previousItem = $item->playlist->items() ->where('order', '<', $item->order) ->orderBy('order', 'desc') ->first(); if ($previousItem) { $tempOrder = $previousItem->order; $previousItem->update(['order' => $item->order]); $item->update(['order' => $tempOrder]); $this->devices = auth()->user()->devices()->with(['playlists.items.plugin'])->get(); } } public function movePlaylistItemDown(PlaylistItem $item) { abort_unless(auth()->user()->devices->contains($item->playlist->device), 403); $nextItem = $item->playlist->items() ->where('order', '>', $item->order) ->orderBy('order') ->first(); if ($nextItem) { $tempOrder = $nextItem->order; $nextItem->update(['order' => $item->order]); $item->update(['order' => $tempOrder]); $this->devices = auth()->user()->devices()->with(['playlists.items.plugin'])->get(); } } public function togglePlaylistItemActive(PlaylistItem $item) { abort_unless(auth()->user()->devices->contains($item->playlist->device), 403); $item->update(['is_active' => !$item->is_active]); $this->devices = auth()->user()->devices()->with(['playlists.items.plugin'])->get(); } public function deletePlaylist(Playlist $playlist) { abort_unless(auth()->user()->devices->contains($playlist->device), 403); $playlist->delete(); $this->devices = auth()->user()->devices()->with(['playlists.items.plugin'])->get(); Flux::modal('delete-playlist-' . $playlist->id)->close(); } public function deletePlaylistItem(PlaylistItem $item) { abort_unless(auth()->user()->devices->contains($item->playlist->device), 403); $item->delete(); $this->devices = auth()->user()->devices()->with(['playlists.items.plugin'])->get(); Flux::modal('delete-playlist-item-' . $item->id)->close(); } public function editPlaylist(Playlist $playlist) { abort_unless(auth()->user()->devices->contains($playlist->device), 403); $this->validate([ 'playlist_name' => 'required|string|max:255', 'selected_weekdays' => 'nullable|array', 'active_from' => 'nullable|date_format:H:i', 'active_until' => 'nullable|date_format:H:i', 'refresh_time' => 'nullable|integer|min:60', ]); if (empty($this->active_from)) { $this->active_from = null; } if (empty($this->active_until)) { $this->active_until = null; } if ($this->refresh_time < 60) { $this->refresh_time = null; } if (empty($this->selected_weekdays)){ $this->selected_weekdays = null; } $playlist->update([ 'name' => $this->playlist_name, 'weekdays' => $this->selected_weekdays, 'active_from' => $this->active_from, 'active_until' => $this->active_until, 'refresh_time' => $this->refresh_time, ]); $this->devices = auth()->user()->devices()->with(['playlists.items.plugin'])->get(); $this->reset(['playlist_name', 'selected_weekdays', 'active_from', 'active_until', 'refresh_time']); Flux::modal('edit-playlist-' . $playlist->id)->close(); } public function preparePlaylistEdit(Playlist $playlist) { $this->playlist_name = $playlist->name; $this->selected_weekdays = $playlist->weekdays ?? null; $this->active_from = optional($playlist->active_from)->format('H:i'); $this->active_until = optional($playlist->active_until)->format('H:i'); $this->refresh_time = $playlist->refresh_time; } }; ?>
|
Plugin / Recipe
|
Status
|
Actions
|
|---|---|---|
|
@if($item->isMashup())
{{ $item->getMashupName() }}
{{ $item->plugin->name }}
@endif
|
|
@if($playlist->items->count() > 1)
@if(!$loop->first)
@if($item->isMashup()) This will remove this mashup from the playlist. @else This will remove this item from the playlist. @endif |
This will permanently delete this playlist and all its items.
Add playlists to your devices to see them here.
@if($devices->isNotEmpty())