feat: simple related media block on results page
This commit is contained in:
@@ -247,6 +247,21 @@ class Tmdb
|
||||
return $series;
|
||||
}
|
||||
|
||||
public function relatedMedia(string $tmdbId, string $mediaType, int $maxResults = 6)
|
||||
{
|
||||
$repos = [
|
||||
'movies' => $this->movieRepository,
|
||||
'tvshows' => $this->tvRepository,
|
||||
];
|
||||
|
||||
$results = $repos[$mediaType]->getRecommendations($tmdbId);
|
||||
return Map::from(array_values($results->toArray()))
|
||||
->slice(0, 6)
|
||||
->map(function ($result) use ($mediaType) {
|
||||
return $this->parseResult($result, $mediaType);
|
||||
})->toArray();
|
||||
}
|
||||
|
||||
public function mediaDetails(string $id, string $type)
|
||||
{
|
||||
$id = $this->find($id);
|
||||
|
||||
Reference in New Issue
Block a user