From 842af8669b9a5148157bba65575505fc0c5e27a9 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Tue, 17 Apr 2018 20:17:42 -0600 Subject: [PATCH] Add follower/following methods to profile --- app/Profile.php | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 app/Profile.php diff --git a/app/Profile.php b/app/Profile.php new file mode 100644 index 000000000..aab29148b --- /dev/null +++ b/app/Profile.php @@ -0,0 +1,37 @@ +hasMany(Status::class); + } + + public function following() + { + return $this->hasManyThrough( + Profile::class, + Follower::class, + 'profile_id', + 'id', + 'id', + 'id' + ); + } + + public function followers() + { + return $this->hasManyThrough( + Profile::class, + Follower::class, + 'following_id', + 'id', + 'id', + 'id' + ); + } +}