Файл: app/Http/Controllers/Load/NewController.php
Строк: 42
<?php
declare(strict_types=1);
namespace AppHttpControllersLoad;
use AppHttpControllersController;
use AppModelsComment;
use AppModelsDown;
use IlluminateViewView;
class NewController extends Controller
{
    /**
     * Новые файлы
     */
    public function files(): View
    {
        $downs = Down::query()
            ->where('active', 1)
            ->orderByDesc('created_at')
            ->with('category', 'user')
            ->paginate(setting('downlist'));
        return view('loads/new_files', compact('downs'));
    }
    /**
     * Новые комментарии
     */
    public function comments(): View
    {
        $comments = Comment::query()
            ->select('comments.*', 'title', 'count_comments')
            ->where('relate_type', Down::$morphName)
            ->leftJoin('downs', 'comments.relate_id', 'downs.id')
            ->orderByDesc('comments.created_at')
            ->with('user')
            ->paginate(setting('comments_per_page'));
        return view('loads/new_comments', compact('comments'));
    }
}