32 lines
724 B
PHP
32 lines
724 B
PHP
<?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();
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|