UserJifenRepositoryEloquent.php 1.1 KB

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