From 869360a7445492c813b823c05a6a87742de6917c Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Mon, 8 Jul 2019 21:46:32 -0600 Subject: [PATCH] Update HashtagFollowerController, add getTags api method --- app/Http/Controllers/HashtagFollowController.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/app/Http/Controllers/HashtagFollowController.php b/app/Http/Controllers/HashtagFollowController.php index be47a928..585248ab 100644 --- a/app/Http/Controllers/HashtagFollowController.php +++ b/app/Http/Controllers/HashtagFollowController.php @@ -47,4 +47,15 @@ class HashtagFollowController extends Controller 'state' => $state ]; } + + public function getTags(Request $request) + { + return HashtagFollow::with('hashtag')->whereUserId(Auth::id()) + ->inRandomOrder() + ->take(3) + ->get() + ->map(function($follow, $k) { + return $follow->hashtag->name; + }); + } }