DevRepository.php 776 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. namespace App\Module\Dev\Repositorys;
  3. use App\Module\Dev\Models\Dev;
  4. use App\Repositories\BaseRepository;
  5. class DevRepository extends BaseRepository
  6. {
  7. /**
  8. * 构造函数
  9. */
  10. public function __construct()
  11. {
  12. parent::__construct(new Dev());
  13. }
  14. /**
  15. * 获取开发列表
  16. *
  17. * @param array $params
  18. * @return mixed
  19. */
  20. public function getList(array $params = [])
  21. {
  22. $query = $this->model->newQuery();
  23. if (!empty($params['name'])) {
  24. $query->where('name', 'like', '%' . $params['name'] . '%');
  25. }
  26. if (isset($params['status'])) {
  27. $query->where('status', $params['status']);
  28. }
  29. return $query->paginate($params['per_page'] ?? 15);
  30. }
  31. }