Skip to content

Commit

Permalink
fix(资讯): 修复资讯后台筛选指定所属类别无效问题 fix#495
Browse files Browse the repository at this point in the history
  • Loading branch information
medz committed Dec 10, 2018
1 parent 097e6fd commit 9e3078b
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ public function index(Request $request, NewsPinned $newsPinnedModel)
$max_id = $request->query('max_id', 0);
$user = $request->query('user');
$state = $request->query('state');
$category = $request->query('cate_id');

$pinneds = $newsPinnedModel->with('news', 'user')
->where('channel', 'news')
Expand All @@ -66,6 +67,9 @@ public function index(Request $request, NewsPinned $newsPinnedModel)
->when($user, function ($query) use ($user) {
return $query->where('user_id', $user);
})
->when($category, function ($query) use ($category) {
return $query->where('cate_id', $category);
})
->whereExists(function ($query) {
return $query->from('news')->whereRaw('news.id = news_pinneds.target')->where('deleted_at', null);
})
Expand Down

0 comments on commit 9e3078b

Please sign in to comment.