1、帖子搜索
2、收藏搜索 3、帖子、评论删除
This commit is contained in:
@@ -46,6 +46,25 @@ class PostFavoriteService
|
||||
return $this->postProcess(ucfirst($scene), $result);
|
||||
}
|
||||
|
||||
public function complexQueryIndex(Request $request)
|
||||
{
|
||||
$param = $request->all();
|
||||
$limit = (int)$request->get('size', 15);
|
||||
$page = (int)$request->get('current', 1);
|
||||
$query = PostFavorite::with(['post'])
|
||||
->where('user_id',$request->user->uid)
|
||||
->whereHas('post', function ($q) use ($param) {
|
||||
// 固定过滤 status = 1
|
||||
$q->where('status', 1);
|
||||
|
||||
// 关键字过滤(如果存在)
|
||||
if (!empty($param['keyword'])) {
|
||||
$q->where('content', 'like', "%{$param['keyword']}%");
|
||||
}
|
||||
});
|
||||
return $query->paginate($limit, ['*'], 'page', $page);
|
||||
}
|
||||
|
||||
/**
|
||||
* 构造 CrudUtil 查询配置
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user