CircleMemberRepository.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: Administrator
  5. * Date: 2019/6/5
  6. * Time: 16:03
  7. */
  8. namespace App\Repositories\Circle;
  9. use App\Models\InterestCircle;
  10. use App\Models\InterestCircleArticle;
  11. use App\Models\InterestCircleUser;
  12. use App\Models\Post;
  13. use Illuminate\Database\QueryException;
  14. use Dingo\Api\Http\Response;
  15. use Illuminate\Support\Carbon;
  16. use Illuminate\Support\Facades\DB;
  17. use Illuminate\Support\Facades\Log;
  18. use Illuminate\Support\Facades\Redis;
  19. class CircleMemberRepository
  20. {
  21. public function __construct(InterestCircle $interestCircle,
  22. InterestCircleUser $interestCircleUser
  23. )
  24. {
  25. $this->interestCircle = $interestCircle;
  26. $this->interestCircleUser = $interestCircleUser;
  27. }
  28. /**
  29. * 成员列表
  30. */
  31. public function lists($request)
  32. {
  33. $perPage = isset($request['per_page']) ? $request['per_page'] : 20;
  34. //$where[] = ['is_black', 0];
  35. $where[] = ['circle_id', $request['id']];
  36. $userModel = $this->interestCircleUser;
  37. return $userModel
  38. ->where($where)
  39. ->orderBy('id', 'desc')
  40. ->paginate($perPage);
  41. }
  42. }