StatisticsUserRepository.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <?php
  2. namespace App\Repositories\Statistics;
  3. use App\Models\StatisticsUser;
  4. use Prettus\Repository\Eloquent\BaseRepository;
  5. /**
  6. * Class StatisticsUserRepositoryEloquent.
  7. *
  8. * @package namespace App\Repositories;
  9. */
  10. class StatisticsUserRepository extends BaseRepository
  11. {
  12. public function model()
  13. {
  14. return StatisticsUser::class;
  15. }
  16. public function getUser($account)
  17. {
  18. return $this->model->where('username', $account)->first();
  19. }
  20. public function getUsers($where, $limit = '')
  21. {
  22. $res = $this->model->where($where);
  23. if ($limit) {
  24. $res->paginate($limit);
  25. }
  26. return $res->get();
  27. }
  28. public function getUserInfo($where)
  29. {
  30. return $this->model->where($where)->first();
  31. }
  32. public function updateUserInfo($data, $where)
  33. {
  34. return $this->model->where($where)->update($data);
  35. }
  36. public function createUserInfo($data)
  37. {
  38. return $this->model->create($data);
  39. }
  40. public function deleteUserInfo($where)
  41. {
  42. return $this->model->where($where)->delete();
  43. }
  44. }