blue-twilight/app/Http/Controllers/Gallery/ExploreController.php

41 lines
1007 B
PHP
Raw Normal View History

<?php
namespace App\Http\Controllers\Gallery;
use App\Facade\Theme;
use App\Facade\UserConfig;
use App\Http\Controllers\Controller;
use App\User;
use App\UserFollower;
class ExploreController extends Controller
{
public function users()
{
if (!UserConfig::get('social_user_profiles'))
{
return redirect(route('home'));
}
$users = User::where([
'is_activated' => true,
'enable_profile_page' => true
])
->orderBy('name')
->paginate(UserConfig::get('items_per_page'));
$usersFollowing = UserFollower::where('user_id', $this->getUser()->id)
->select('following_user_id')
->get()
->map(function($f)
{
return $f->following_user_id;
})
->toArray();
return Theme::render('gallery.explore_users', [
'users' => $users,
'users_following' => $usersFollowing
]);
}
}