some improvements
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace App\Livewire\MoviePage;
|
||||
|
||||
use App\Models\Movie;
|
||||
use Livewire\Component;
|
||||
|
||||
class Collection extends Component
|
||||
{
|
||||
public $movie;
|
||||
public $collection;
|
||||
public $collectionMovies;
|
||||
|
||||
public function render()
|
||||
{
|
||||
return view('livewire.movie-page.collection');
|
||||
}
|
||||
|
||||
public function mount()
|
||||
{
|
||||
// Get the collection for this movie
|
||||
$this->collection = $this->movie->collections()->first();
|
||||
|
||||
if ($this->collection) {
|
||||
// Get all movies in this collection
|
||||
$this->collectionMovies = $this->collection->movies()
|
||||
->where('movies.id', '!=', $this->movie->id) // Exclude the current movie
|
||||
->get();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user