playing = new EloquentCollection(); $this->nextSong = new EloquentCollection(); $this->finished = new EloquentCollection(); $this->roomSession = request()->roomSession; $this->refreshSongs(); } public function refreshSongs() { $dbSession = $this->roomSession->refreshValid(); if (!$dbSession) { session()->forget('room_code'); return $this->redirect(route('welcome'), navigate: true); } $this->playing = OrderedSong::forSession($this->roomSession->id)->playing()->get(); $this->nextSong = OrderedSong::forSession($this->roomSession->id)->nextSong()->get(); $this->finished = OrderedSong::forSession($this->roomSession->id)->finished()->get(); } public function render() { return view('livewire.pages.ordered-song-list', [ 'playing' => $this->playing, 'nextSong' => $this->nextSong, 'finished' => $this->finished, ]); } }