HEX
Server: Microsoft-IIS/8.5
System: Windows NT YDAWBH120 6.3 build 9600 (Windows Server 2012 R2 Standard Edition) AMD64
User: tentjecom_web (0)
PHP: 7.4.14
Disabled: NONE
Upload Files
File: D:/HostingSpaces/SBogers10/ijzerenman.komma.pro/app/Custom/News/NewsRepository.php
<?php


namespace Komma\News;


use Carbon\Carbon;

class NewsRepository
{
    /**
     * Return all published news items
     *
     * @return \Illuminate\Pagination\Paginator
     */
    public function publishedNewsItems()
    {
        return \DB::table('news_items')
            // Join Translations
            ->leftJoin('news_item_translations', 'news_items.id', '=', 'news_item_translations.news_item_id')
            // Join Images
            ->leftJoin('images', function ($join) {
               $join->on('news_items.id', '=', 'images.imageble_id')
                    ->where('images.imageble_type', '=', 'Komma\Kms\News\Models\NewsItem');
            })
            // Only published
            ->where('published_at','<=', Carbon::now()->addHour())

            // Exclude root
            ->where('news_items.lft','!=',1)

            ->orderBy('published_at','desc')
            ->select()
            ->paginate(3);
    }
}