summaryrefslogtreecommitdiff
path: root/app/Http/Controllers/CinemaController.php
diff options
context:
space:
mode:
authorDeveloper2026-06-27 04:12:21 +0200
committerDeveloper2026-06-27 04:12:21 +0200
commitdc3cbbfdd9455e419eaaf776c16544afdf95eadb (patch)
tree703bc352f7e3965afb6a8327f8854a0c430fedb5 /app/Http/Controllers/CinemaController.php
parent33b69f87babac5116db923b906512411488eb28a (diff)
downloadcurious-dc3cbbfdd9455e419eaaf776c16544afdf95eadb.tar.gz
feat: add Hacker News stories section to movie detail page
Links to every HN story referencing this movie, ordered by most recent. Each entry shows date, score (if > 0), and descendants (if > 0).
Diffstat (limited to 'app/Http/Controllers/CinemaController.php')
-rw-r--r--app/Http/Controllers/CinemaController.php17
1 files changed, 17 insertions, 0 deletions
diff --git a/app/Http/Controllers/CinemaController.php b/app/Http/Controllers/CinemaController.php
index 8a9bb0e..d8adefa 100644
--- a/app/Http/Controllers/CinemaController.php
+++ b/app/Http/Controllers/CinemaController.php
@@ -94,12 +94,29 @@ class CinemaController extends Controller
$directors = $casts->where('profession', 'director');
$screenwriters = $casts->where('profession', 'screenwriter')->take(3);
+ $hnStories = DB::connection('cinema')
+ ->table('links')
+ ->join('story', 'story.id', '=', 'links.story_id')
+ ->select(
+ 'story.story_id',
+ 'story.title',
+ 'story.score',
+ 'story.descendants',
+ 'story.time'
+ )
+ ->where('links.host', 'www.imdb.com')
+ ->where('links.field', 1)
+ ->where('links.param', $id)
+ ->orderBy('story.time', 'desc')
+ ->get();
+
return view('cinema_show', [
'movie' => $movie,
'genres' => $genres,
'actors' => $actors,
'directors' => $directors,
'screenwriters' => $screenwriters,
+ 'hnStories' => $hnStories,
]);
}