phpvms/app/Repositories/NewsRepository.php
Arthur Parienté 489a68b54e
[8.x] feat(phpstan): support levels 3, 4 and 5 (#2095)
* wip

* feat(phpstan): support level 3

* feat(phpstan): support level 4

* feat(phpstan): support level 5

* fix(phpstan): fix Money constructor

* some fixes after merge

* fix time during tests
2025-10-21 13:05:36 -05:00

35 lines
685 B
PHP

<?php
namespace App\Repositories;
use App\Contracts\Repository;
use App\Models\News;
use Prettus\Repository\Contracts\CacheableInterface;
use Prettus\Repository\Traits\CacheableRepository;
/**
* Class NewsRepository
*/
class NewsRepository extends Repository implements CacheableInterface
{
use CacheableRepository;
public function model()
{
return News::class;
}
/**
* Latest news items
*
* @param int $count
* @return mixed
*/
public function getLatest($count = 5)
{
return $this->orderBy('created_at', 'desc')
->with(['user'])
->paginate($count); // @phpstan-ignore-line
}
}