1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- <?php
- /**
- * Created by PhpStorm.
- * User: Administrator
- * Date: 2019/6/5
- * Time: 16:03
- */
- namespace App\Repositories\Circle;
- use App\Models\InterestCircle;
- use App\Models\InterestCircleArticle;
- use App\Models\InterestCircleMessage;
- use App\Models\InterestCircleMessageComment;
- use App\Models\InterestCircleUser;
- use App\Models\Post;
- use Illuminate\Database\QueryException;
- use Dingo\Api\Http\Response;
- use Illuminate\Support\Carbon;
- use Illuminate\Support\Facades\DB;
- use Illuminate\Support\Facades\Log;
- use Illuminate\Support\Facades\Redis;
- class CircleMessageRepository
- {
- public function __construct(InterestCircle $interestCircle,
- InterestCircleMessage $interestCircleMessage,
- InterestCircleMessageComment $interestCircleMessageComment
- )
- {
- $this->interestCircle = $interestCircle;
- $this->interestCircleMessage = $interestCircleMessage;
- $this->interestCircleMessageComment = $interestCircleMessageComment;
- }
- /**
- * 提问列表
- */
- public function lists($request)
- {
- $perPage = isset($request['per_page']) ? $request['per_page'] : 20;
- $where[] = ['circle_id', $request['id']];
- return $this->interestCircleMessage
- ->where($where)
- ->orderBy('is_recommend', 'desc')
- ->orderBy('id', 'desc')
- ->paginate($perPage);
- }
- }
|