AuthRepositoryEloquent.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. namespace App\Repositories\Eloquent\Base;
  3. use App\Contracts\Repositories\Base\AuthRepository;
  4. use App\Repositories\Models\Base\Auth;
  5. use App\Repositories\Validators\Base\AuthValidator;
  6. use Prettus\Repository\Criteria\RequestCriteria;
  7. use Prettus\Repository\Eloquent\BaseRepository;
  8. class AuthRepositoryEloquent extends BaseRepository implements AuthRepository
  9. {
  10. protected $fieldSearchable = [
  11. // 'name' => 'like', Default Condition "="
  12. ];
  13. /**
  14. * Specify Model class name.
  15. *
  16. * @return string
  17. */
  18. public function model()
  19. {
  20. return Auth::class;
  21. }
  22. /**
  23. * Boot up the repository, pushing criteria.
  24. *
  25. * @throws \Prettus\Repository\Exceptions\RepositoryException
  26. */
  27. public function boot()
  28. {
  29. $this->pushCriteria(app(RequestCriteria::class));
  30. }
  31. /**
  32. * @return mixed
  33. */
  34. public function searchAuthsByPage()
  35. {
  36. return $this->paginate(request('per_page', 15));
  37. }
  38. /**
  39. * @param $id
  40. *
  41. * @return mixed
  42. */
  43. public function searchAuthBy($id)
  44. {
  45. return $this->find($id);
  46. }
  47. }