id = $id; $this->getList(); } public function getList() { $list = MovieListModel::with('movies') ->find($this->id); if ($list) { $this->list = $list; $this->movies = $list->movies; } else { abort(404); } } public function addMovie(MovieDbInterface $movie_db) { $this->resetErrorBag(); try { $movie = $movie_db->search($this->query); } catch (NotFoundHttpException $e) { $this->addError('query', 'Movie not found'); return; } $this->list->movies()->syncWithoutDetaching($movie->id); $this->getList(); $this->form->reset(); } public function render() { return view('livewire.movie-list'); } }