AttachRepositoryEloquent.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <?php
  2. namespace App\Repositories\Eloquent\Course;
  3. use App\Repositories\Criteria\Course\AttachCriteria;
  4. use App\Repositories\Criteria\RequestCriteria;
  5. use Prettus\Repository\Eloquent\BaseRepository;
  6. use App\Contracts\Repositories\Course\AttachRepository;
  7. use App\Repositories\Models\Course\Attach;
  8. use App\Repositories\Validators\Course\AttachValidator;
  9. /**
  10. * Class CourseAttachRepositoryEloquent.
  11. *
  12. * @package namespace App\Repositories\Eloquent;
  13. */
  14. class AttachRepositoryEloquent extends BaseRepository implements AttachRepository
  15. {
  16. /**
  17. * Specify Model class name
  18. *
  19. * @return string
  20. */
  21. public function model()
  22. {
  23. return Attach::class;
  24. }
  25. /**
  26. * Specify Validator class name
  27. *
  28. * @return mixed
  29. */
  30. public function validator()
  31. {
  32. return AttachValidator::class;
  33. }
  34. /**
  35. * Boot up the repository, pushing criteria
  36. */
  37. public function boot()
  38. {
  39. $this->pushCriteria(app(RequestCriteria::class));
  40. }
  41. /**
  42. * @return mixed
  43. */
  44. public function searchAttachsByPage()
  45. {
  46. return $this->paginate(request('per_page', 15));
  47. }
  48. /**
  49. * @param $id
  50. *
  51. * @return mixed
  52. */
  53. public function searchAttachBy($id)
  54. {
  55. return $this->find($id);
  56. }
  57. }