CommentRepositoryEloquent.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. namespace App\Repositories\Eloquent\Course;
  3. use App\Repositories\Criteria\Course\CommentCriteria;
  4. use App\Repositories\Criteria\RequestCriteria;
  5. use App\Repositories\Presenters\Course\CommentPresenter;
  6. use Prettus\Repository\Eloquent\BaseRepository;
  7. use App\Contracts\Repositories\Course\CommentRepository;
  8. use App\Repositories\Models\Course\Comment;
  9. /**
  10. * Class CourseCommentRepositoryEloquent.
  11. *
  12. * @package namespace App\Repositories\Eloquent;
  13. */
  14. class CommentRepositoryEloquent extends BaseRepository implements CommentRepository
  15. {
  16. /**
  17. * Specify Model class name
  18. *
  19. * @return string
  20. */
  21. public function model()
  22. {
  23. return Comment::class;
  24. }
  25. /**
  26. * Boot up the repository, pushing criteria
  27. */
  28. public function boot()
  29. {
  30. $this->pushCriteria(app(RequestCriteria::class));
  31. }
  32. /**
  33. * @return mixed
  34. */
  35. public function searchCommentsByPage()
  36. {
  37. return $this->paginate(request('per_page', 15));
  38. }
  39. /**
  40. * @param $id
  41. *
  42. * @return mixed
  43. */
  44. public function searchCommentBy($id)
  45. {
  46. return $this->find($id);
  47. }
  48. }