MenuRepositoryEloquent.php 1.0 KB

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