本文整理匯總了PHP中app\Comment::whereIn方法的典型用法代碼示例。如果您正苦於以下問題:PHP Comment::whereIn方法的具體用法?PHP Comment::whereIn怎麽用?PHP Comment::whereIn使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類app\Comment
的用法示例。
在下文中一共展示了Comment::whereIn方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: multidelete
public function multidelete()
{
$id = Input::get('id');
$do = new Comment();
$list = $do->whereIn('id', $id)->delete();
if ($list) {
return Redirect::back()->withErrors(Null);
} else {
return Redirect::back()->withInput()->withErrors('comment delete fail!');
}
}
示例2: handle
/**
* Handle the event.
*
* @param SingleAdLoaded $event
* @return void
*/
public function handle(SingleAdLoaded $event)
{
$ad = $event->ad;
$ad->increment('views');
if ($user = Auth::user()) {
if ($user->id == $ad->author_id) {
$ad->comments()->where('answer_to', null)->update(['is_viewed' => true]);
} else {
$questions_ids = $ad->comments()->where('author_id', $user->id)->get()->map(function ($question) {
return $question->id;
});
Comment::whereIn('answer_to', $questions_ids)->update(['is_viewed' => true]);
}
}
}
示例3: delcomment
public function delcomment(Request $request)
{
$id = (array) $request->id;
$comments = Comment::whereIn('id', $id)->get(['article_id']);
if ($comments) {
$articleIds = $comments->fetch('article_id');
Comment::whereIn('id', $id)->delete();
foreach ($articleIds as $article_id) {
Article::withTrashed()->whereId($article_id)->decrement('comment_count');
}
return response()->json(200);
} else {
return response()->json(404);
}
return response()->json($articleIds);
}
示例4: getSubComments
public function getSubComments()
{
$ids = SubComment::where('comment_id_from', '=', $this->id)->orderBy('created_at', 'DESC')->lists('comment_id_sub');
return Comment::whereIn('id', $ids)->get();
}