1 | <?php |
||
2 | |||
3 | namespace App\Services; |
||
4 | |||
5 | use App\Repositories\Criteria\OrderBy; |
||
6 | use App\Repositories\Criteria\Where; |
||
7 | use App\Repositories\TopicRepository; |
||
8 | |||
9 | class TopicService |
||
10 | { |
||
11 | private $repository; |
||
12 | |||
13 | /** |
||
14 | * TopicService constructor. |
||
15 | */ |
||
16 | public function __construct() |
||
17 | { |
||
18 | $this->repository = app(TopicRepository::class); |
||
19 | } |
||
20 | |||
21 | public function topicsForContest($contestId) |
||
22 | { |
||
23 | $this->repository->pushCriteria(new Where('contest_id', $contestId)); |
||
24 | $this->repository->pushCriteria(new OrderBy('created_at', 'desc')); |
||
25 | |||
26 | return $this->repository->paginate(request('per_page', 50)); |
||
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||
27 | } |
||
28 | } |
||
29 |