BannerRepositoryEloquent.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <?php
  2. namespace App\Repositories\Eloquent;
  3. use Prettus\Repository\Eloquent\BaseRepository;
  4. use Prettus\Repository\Criteria\RequestCriteria;
  5. use App\Repositories\BannerRepository;
  6. use App\Models\Banner;
  7. use App\Validators\BannerValidator;
  8. /**
  9. * Class BannerRepositoryEloquent.
  10. *
  11. * @package namespace App\Repositories\Eloquent;
  12. */
  13. class BannerRepositoryEloquent extends BaseRepository implements BannerRepository
  14. {
  15. /**
  16. * 查询检索的字段
  17. *
  18. * @return string
  19. */
  20. protected $fieldSearchable = [
  21. 'id' => '=',
  22. 'show' => '=',
  23. 'type' => '=',
  24. 'title' => 'like',
  25. ];
  26. /**
  27. * Specify Model class name
  28. *
  29. * @return string
  30. */
  31. public function model()
  32. {
  33. return Banner::class;
  34. }
  35. /**
  36. * Specify Validator class name
  37. *
  38. * @return mixed
  39. */
  40. public function validator()
  41. {
  42. return BannerValidator::class;
  43. }
  44. /**
  45. * Boot up the repository, pushing criteria
  46. */
  47. public function boot()
  48. {
  49. // $this->pushCriteria(app(RequestCriteria::class));
  50. }
  51. }