/** * Load Items * * @param int $maxItems * @return array|static[] */ public static function loadItems($maxItems = 10) { try { $items = Item::select(['adrenth_rssfetcher_items.*', 'adrenth_rssfetcher_sources.name AS source'])->join('adrenth_rssfetcher_sources', 'adrenth_rssfetcher_items.source_id', '=', 'adrenth_rssfetcher_sources.id')->where('adrenth_rssfetcher_sources.is_enabled', '=', 1)->where('adrenth_rssfetcher_items.is_published', '=', 1)->orderBy('adrenth_rssfetcher_items.pub_date', 'desc')->limit($maxItems); } catch (\InvalidArgumentException $e) { return []; } return $items->get(); }
/** * Load Items * * @return LengthAwarePaginator|array */ protected function loadItems() { try { $items = Item::select(['adrenth_rssfetcher_items.*', 'adrenth_rssfetcher_sources.name AS source'])->join('adrenth_rssfetcher_sources', 'adrenth_rssfetcher_items.source_id', '=', 'adrenth_rssfetcher_sources.id')->where('adrenth_rssfetcher_sources.is_enabled', '=', 1)->where('adrenth_rssfetcher_items.is_published', '=', 1)->orderBy('adrenth_rssfetcher_items.pub_date', 'desc')->paginate($this->property('itemsPerPage')); } catch (\InvalidArgumentException $e) { return []; } return $items; }