RelationshipSettings.php 962 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?php
  2. namespace App\Http\Controllers\Settings;
  3. use App\AccountLog;
  4. use App\EmailVerification;
  5. use App\Instance;
  6. use App\Media;
  7. use App\Profile;
  8. use App\User;
  9. use App\UserFilter;
  10. use App\Util\Lexer\PrettyNumber;
  11. use Auth, Cache, DB;
  12. use Illuminate\Http\Request;
  13. trait RelationshipSettings
  14. {
  15. public function relationshipsHome(Request $request)
  16. {
  17. $this->validate($request, [
  18. 'mode' => 'nullable|string|in:following,followers,hashtags'
  19. ]);
  20. $mode = $request->input('mode');
  21. $profile = Auth::user()->profile;
  22. switch ($mode) {
  23. case 'following':
  24. $data = $profile->following()->simplePaginate(10);
  25. break;
  26. case 'followers':
  27. $data = $profile->followers()->simplePaginate(10);
  28. break;
  29. case 'hashtags':
  30. $data = $profile->hashtagFollowing()->with('hashtag')->simplePaginate(10);
  31. break;
  32. default:
  33. $data = [];
  34. break;
  35. }
  36. return view('settings.relationships.home', compact('profile', 'mode', 'data'));
  37. }
  38. }