diff --git a/timeliner/app/Http/Controllers/TimelineController.php b/timeliner/app/Http/Controllers/TimelineController.php index e9167ac..ced0ccf 100644 --- a/timeliner/app/Http/Controllers/TimelineController.php +++ b/timeliner/app/Http/Controllers/TimelineController.php @@ -64,17 +64,11 @@ public function show($id) public function showDashboard() { - $user = Auth::user(); + $timelines = $this->timelinesWithOwnership(); - $timelines = DB::select(" - SELECT timelines.* - FROM timelines - JOIN ownerships - ON CAST(SUBSTR(ownerships.id, 1, LENGTH(ownerships.id) - LENGTH(?)) AS INTEGER) = timelines.id - WHERE CAST(SUBSTR(ownerships.id, -LENGTH(?)) AS INTEGER) = ? - ", [$user->id, $user->id, $user->id]); + $timelinesWithOwnership = $this->timelinesWithOwnership(); - return view('dashboard',['timelines' => $timelines]); + return view('dashboard',['timelines' => $timelines, 'timelinesWithOwnership' => $timelinesWithOwnership]); } public function create() diff --git a/timeliner/resources/views/dashboard.blade.php b/timeliner/resources/views/dashboard.blade.php index 29d634b..a6da339 100644 --- a/timeliner/resources/views/dashboard.blade.php +++ b/timeliner/resources/views/dashboard.blade.php @@ -11,9 +11,6 @@