From 17fa86ad2f4fb63c70b44de10e38ba78a84de0f4 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Sun, 16 Jun 2019 17:38:23 -0600 Subject: [PATCH] Update Relationship settings, separate following and followers --- .../Settings/RelationshipSettings.php | 15 +- .../settings/relationships/home.blade.php | 208 +++++++++--------- 2 files changed, 116 insertions(+), 107 deletions(-) diff --git a/app/Http/Controllers/Settings/RelationshipSettings.php b/app/Http/Controllers/Settings/RelationshipSettings.php index a61e8b83..efc369fe 100644 --- a/app/Http/Controllers/Settings/RelationshipSettings.php +++ b/app/Http/Controllers/Settings/RelationshipSettings.php @@ -16,13 +16,20 @@ use Illuminate\Http\Request; trait RelationshipSettings { - public function relationshipsHome() + public function relationshipsHome(Request $request) { + $mode = $request->input('mode') == 'following' ? 'following' : 'followers'; $profile = Auth::user()->profile; - $following = $profile->following()->simplePaginate(10); - $followers = $profile->followers()->simplePaginate(10); - return view('settings.relationships.home', compact('profile', 'following', 'followers')); + $following = $followers = []; + + if($mode == 'following') { + $data = $profile->following()->simplePaginate(10); + } else { + $data = $profile->followers()->simplePaginate(10); + } + + return view('settings.relationships.home', compact('profile', 'mode', 'data')); } } \ No newline at end of file diff --git a/resources/views/settings/relationships/home.blade.php b/resources/views/settings/relationships/home.blade.php index 1332e3f8..c4183534 100644 --- a/resources/views/settings/relationships/home.blade.php +++ b/resources/views/settings/relationships/home.blade.php @@ -2,116 +2,118 @@ @section('section') -
-

Followers & Following

-
-
- @if(empty($following) && empty($followers)) -

You are not following anyone, or followed by anyone.

- @else - - - - - - - - - - - @foreach($followers as $follower) - - - - - - - @endforeach - - @foreach($following as $follower) - - - - - - - @endforeach - -
- - UsernameRelationshipAction
- {{-- --}} - - {{$follower->username}} - Follower - Mute - Block -
- - - {{$follower->username}} - Following - Unfollow -
-
{{$following->links() ?? $followers->links()}}
- @endif +
+

Followers & Following

+
+
+@if(empty($data)) +

You are not {{$mode == 'following' ? 'following anyone.' : 'followed by anyone.'}}

+@else + +
+ + + + + + + + + + + @foreach($data as $follower) + + + + @if($mode == 'following') + + + @else + + + @endif + + @endforeach + +
+ + UsernameRelationshipAction
+ {{-- --}} + + + {{$follower->username}} + Following + Unfollow + Follower + Mute + Block +
+
{{$data->appends(['mode' => $mode])->links()}}
+@endif @endsection @push('scripts') @endpush \ No newline at end of file