1
0
Fork 1
mirror of https://github.com/pixelfed/pixelfed.git synced 2024-12-25 01:05:36 +00:00
pixelfed/app/Http/Controllers/Settings/RelationshipSettings.php
2019-07-10 21:26:05 -06:00

49 lines
No EOL
962 B
PHP

<?php
namespace App\Http\Controllers\Settings;
use App\AccountLog;
use App\EmailVerification;
use App\Instance;
use App\Media;
use App\Profile;
use App\User;
use App\UserFilter;
use App\Util\Lexer\PrettyNumber;
use Auth, Cache, DB;
use Illuminate\Http\Request;
trait RelationshipSettings
{
public function relationshipsHome(Request $request)
{
$this->validate($request, [
'mode' => 'nullable|string|in:following,followers,hashtags'
]);
$mode = $request->input('mode');
$profile = Auth::user()->profile;
switch ($mode) {
case 'following':
$data = $profile->following()->simplePaginate(10);
break;
case 'followers':
$data = $profile->followers()->simplePaginate(10);
break;
case 'hashtags':
$data = $profile->hashtagFollowing()->with('hashtag')->simplePaginate(10);
break;
default:
$data = [];
break;
}
return view('settings.relationships.home', compact('profile', 'mode', 'data'));
}
}