mirror of
https://github.com/HDInnovations/UNIT3D-Community-Edition.git
synced 2026-04-23 19:50:40 -05:00
(Update) User Online Block 🚀
This commit is contained in:
@@ -83,10 +83,20 @@ class HomeController extends Controller
|
||||
$posts = Post::latest()->take(5)->get();
|
||||
|
||||
// Online Block
|
||||
$current = Carbon::now();
|
||||
$expiresAt = $current->addMinutes(60);
|
||||
|
||||
$cached_users = cache()->remember('online-users', $expiresAt, function () {
|
||||
return User::pluck('id');
|
||||
});
|
||||
|
||||
$users = User::with(['privacy', 'group' => function ($query) {
|
||||
$query->select(['id', 'name', 'color', 'effect', 'icon', 'position']);
|
||||
}])->select(['id', 'username', 'hidden', 'group_id'])->oldest('username')->get();
|
||||
$groups = Group::select(['name', 'color', 'effect', 'icon'])->oldest('position')->get();
|
||||
}])->whereIn('id', $cached_users)->select(['id', 'username', 'hidden', 'group_id'])->oldest('username')->get();
|
||||
|
||||
$groups = cache()->remember('user-groups', $expiresAt, function () {
|
||||
return Group::select(['name', 'color', 'effect', 'icon'])->oldest('position')->get();
|
||||
});
|
||||
|
||||
// Featured Torrents Block
|
||||
$featured = FeaturedTorrent::with('torrent')->get();
|
||||
|
||||
Reference in New Issue
Block a user