diff --git a/app/Http/Controllers/Settings/RelationshipSettings.php b/app/Http/Controllers/Settings/RelationshipSettings.php index a61e8b839..efc369fe6 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 1332e3f88..c4183534a 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