RoleRepositoryEloquent.php 1.4 KB

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