DepartmentRepositoryEloquent.php 1.3 KB

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