當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Comment::whereIn方法代碼示例

本文整理匯總了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!');
     }
 }
開發者ID:luowc302,項目名稱:SelfProject,代碼行數:11,代碼來源:CommentController.php

示例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]);
         }
     }
 }
開發者ID:elberd,項目名稱:maoh,代碼行數:21,代碼來源:SetViews.php

示例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);
 }
開發者ID:misterebs,項目名稱:cmsku,代碼行數:16,代碼來源:ArticleController.php

示例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();
 }
開發者ID:kamyh,項目名稱:KBlog,代碼行數:5,代碼來源:Comment.php


注:本文中的app\Comment::whereIn方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。