-
app/Http/Controllers/HomeController.php
Open in GitHubuse App\Models\Torrent; class HomeController extends Controller { public function index(Request $request): \Illuminate\Contracts\View\Factory | \Illuminate\View\View { // $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()); // } }
-
resources/views/blocks/top_uploaders.blade.php
Open in GitHub// @foreach ($uploaders as $key => $uploader) <tr> <td> <div class="text-center"> <i class="{{ config('other.font-awesome') }} fa-trophy-alt text-gold torrent-icon"></i> </div> </td> <td> @if ($uploader->user->private_profile == 1) <span class="badge-user text-bold"> <span class="text-orange"> <i class="{{ config('other.font-awesome') }} fa-eye-slash" aria-hidden="true"></i> {{ strtoupper(trans('common.hidden')) }} </span> @if ($user->id == $uploader->user->id || $user->group->is_modo == 1) <a href="{{ route('users.show', ['username' => $uploader->user->username]) }}"> ({{ $uploader->user->username }}) </a> @endif </span> @else <a href="{{ route('users.show', ['username' => $uploader->user->username]) }}"> <span class="badge-user text-bold" style="color:{{ $uploader->user->group->color }}; background-image:{{ $uploader->user->group->effect }}; margin-bottom: 10px;"> <i class="{{ $uploader->user->group->icon }}" data-toggle="tooltip" data-original-title="{{ $uploader->user->group->name }}"></i> {{ $uploader->user->username }} </span> </a> @endif </td> <td> <span class="text-green">{{ $uploader->user->getUploads() }}</span> </td> <td> <span class="text-bold"><i class="{{ config('other.font-awesome') }} fa-ribbon"></i> {{ App\Helpers\StringHelper::ordinal(++$key) }} @lang('stat.place')</span> </td> </tr> @endforeach //