mirror of
https://github.com/HDInnovations/UNIT3D-Community-Edition.git
synced 2026-04-23 19:50:40 -05:00
Apply fixes from StyleCI
[ci skip] [skip ci]
This commit is contained in:
@@ -50,30 +50,30 @@ class HomeController extends Controller
|
||||
$user = $request->user();
|
||||
|
||||
// Latest Articles/News Block
|
||||
$articles = cache()->remember('latest_article', $expiresAt, fn() => Article::latest()->take(1)->get());
|
||||
$articles = cache()->remember('latest_article', $expiresAt, fn () => Article::latest()->take(1)->get());
|
||||
|
||||
// Latest Torrents Block
|
||||
$personal_freeleech = PersonalFreeleech::where('user_id', '=', $user->id)->first();
|
||||
|
||||
$newest = cache()->remember('newest_torrents', $expiresAt, fn() => Torrent::with(['user', 'category'])
|
||||
$newest = cache()->remember('newest_torrents', $expiresAt, fn () => Torrent::with(['user', 'category'])
|
||||
->withCount(['thanks', 'comments'])
|
||||
->latest()
|
||||
->take(5)
|
||||
->get());
|
||||
|
||||
$seeded = cache()->remember('seeded_torrents', $expiresAt, fn() => Torrent::with(['user', 'category'])
|
||||
$seeded = cache()->remember('seeded_torrents', $expiresAt, fn () => Torrent::with(['user', 'category'])
|
||||
->withCount(['thanks', 'comments'])
|
||||
->latest('seeders')
|
||||
->take(5)
|
||||
->get());
|
||||
|
||||
$leeched = cache()->remember('leeched_torrents', $expiresAt, fn() => Torrent::with(['user', 'category'])
|
||||
$leeched = cache()->remember('leeched_torrents', $expiresAt, fn () => Torrent::with(['user', 'category'])
|
||||
->withCount(['thanks', 'comments'])
|
||||
->latest('leechers')
|
||||
->take(5)
|
||||
->get());
|
||||
|
||||
$dying = cache()->remember('dying_torrents', $expiresAt, fn() => Torrent::with(['user', 'category'])
|
||||
$dying = cache()->remember('dying_torrents', $expiresAt, fn () => Torrent::with(['user', 'category'])
|
||||
->withCount(['thanks', 'comments'])
|
||||
->where('seeders', '=', 1)
|
||||
->where('times_completed', '>=', 1)
|
||||
@@ -81,7 +81,7 @@ class HomeController extends Controller
|
||||
->take(5)
|
||||
->get());
|
||||
|
||||
$dead = cache()->remember('dead_torrents', $expiresAt, fn() => Torrent::with(['user', 'category'])
|
||||
$dead = cache()->remember('dead_torrents', $expiresAt, fn () => Torrent::with(['user', 'category'])
|
||||
->withCount(['thanks', 'comments'])
|
||||
->where('seeders', '=', 0)
|
||||
->latest('leechers')
|
||||
@@ -89,13 +89,13 @@ class HomeController extends Controller
|
||||
->get());
|
||||
|
||||
// Latest Topics Block
|
||||
$topics = cache()->remember('latest_topics', $expiresAt, fn() => Topic::with('forum')->latest()->take(5)->get());
|
||||
$topics = cache()->remember('latest_topics', $expiresAt, fn () => Topic::with('forum')->latest()->take(5)->get());
|
||||
|
||||
// Latest Posts Block
|
||||
$posts = cache()->remember('latest_posts', $expiresAt, fn() => Post::with('topic', 'user')->latest()->take(5)->get());
|
||||
$posts = cache()->remember('latest_posts', $expiresAt, fn () => Post::with('topic', 'user')->latest()->take(5)->get());
|
||||
|
||||
// Online Block
|
||||
$users = cache()->remember('online_users', $expiresAt, fn() => User::with('group', 'privacy')
|
||||
$users = cache()->remember('online_users', $expiresAt, fn () => User::with('group', 'privacy')
|
||||
->withCount([
|
||||
'warnings' => function (Builder $query) {
|
||||
$query->whereNotNull('torrent')->where('active', '1');
|
||||
@@ -104,23 +104,23 @@ class HomeController extends Controller
|
||||
->where('last_action', '>', now()->subMinutes(5))
|
||||
->get());
|
||||
|
||||
$groups = cache()->remember('user-groups', $expiresAt, fn() => Group::select(['name', 'color', 'effect', 'icon'])->oldest('position')->get());
|
||||
$groups = cache()->remember('user-groups', $expiresAt, fn () => Group::select(['name', 'color', 'effect', 'icon'])->oldest('position')->get());
|
||||
|
||||
// Featured Torrents Block
|
||||
$featured = cache()->remember('latest_featured', $expiresAt, fn() => FeaturedTorrent::with('torrent')->get());
|
||||
$featured = cache()->remember('latest_featured', $expiresAt, fn () => FeaturedTorrent::with('torrent')->get());
|
||||
|
||||
// Latest Poll Block
|
||||
$poll = cache()->remember('latest_poll', $expiresAt, fn() => Poll::latest()->first());
|
||||
$poll = cache()->remember('latest_poll', $expiresAt, fn () => Poll::latest()->first());
|
||||
|
||||
// Top Uploaders Block
|
||||
$uploaders = cache()->remember('top_uploaders', $expiresAt, fn() => Torrent::with('user')
|
||||
$uploaders = cache()->remember('top_uploaders', $expiresAt, fn () => Torrent::with('user')
|
||||
->select(DB::raw('user_id, count(*) as value'))
|
||||
->groupBy('user_id')
|
||||
->latest('value')
|
||||
->take(10)
|
||||
->get());
|
||||
|
||||
$past_uploaders = cache()->remember('month_uploaders', $expiresAt, fn() => Torrent::with('user')
|
||||
$past_uploaders = cache()->remember('month_uploaders', $expiresAt, fn () => Torrent::with('user')
|
||||
->where('created_at', '>', $current->copy()->subDays(30)->toDateTimeString())
|
||||
->select(DB::raw('user_id, count(*) as value'))
|
||||
->groupBy('user_id')
|
||||
|
||||
Reference in New Issue
Block a user