From b35e6d0366e668a1b5608a1f3dbef37b13840053 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Thu, 9 Aug 2018 19:56:50 -0600 Subject: [PATCH] Update AccountController --- app/Http/Controllers/AccountController.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/app/Http/Controllers/AccountController.php b/app/Http/Controllers/AccountController.php index 3ef8ef272..5e66d8271 100644 --- a/app/Http/Controllers/AccountController.php +++ b/app/Http/Controllers/AccountController.php @@ -40,6 +40,25 @@ class AccountController extends Controller return view('account.activity', compact('profile', 'notifications')); } + public function followingActivity(Request $request) + { + $this->validate($request, [ + 'page' => 'nullable|min:1|max:3', + 'a' => 'nullable|alpha_dash', + ]); + $profile = Auth::user()->profile; + $action = $request->input('a'); + $timeago = Carbon::now()->subMonths(1); + $following = $profile->following->pluck('id'); + $notifications = Notification::whereIn('actor_id', $following) + ->where('profile_id', '!=', $profile->id) + ->whereDate('created_at', '>', $timeago) + ->orderBy('notifications.id','desc') + ->simplePaginate(30); + + return view('account.following', compact('profile', 'notifications')); + } + public function verifyEmail(Request $request) { return view('account.verify_email');