当前位置: 首页>>代码示例>>PHP>>正文


PHP Comment::where方法代码示例

本文整理汇总了PHP中Comment::where方法的典型用法代码示例。如果您正苦于以下问题:PHP Comment::where方法的具体用法?PHP Comment::where怎么用?PHP Comment::where使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Comment的用法示例。


在下文中一共展示了Comment::where方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: get

 public function get($id)
 {
     $enemy = Enemy::with('episodes')->find($id);
     $ratings = Rating::getRating('enemy', $id);
     $comments = Comment::where('item_id', $id)->where('item_type', 'enemy')->with('user')->orderBy('created_at', 'desc')->get();
     return View::make('items.enemy', ['enemy' => $enemy, 'ratings' => $ratings, 'comments' => $comments]);
 }
开发者ID:thechrisroberts,项目名称:thedoctor,代码行数:7,代码来源:EnemyController.php

示例2: get

 public function get($season, $episode)
 {
     $episode = Episode::with(['doctors', 'companions', 'enemies'])->where('season', $season)->where('episode', $episode)->first();
     $ratings = Rating::getRating('episode', $episode->id);
     $comments = Comment::where('item_id', $episode->id)->where('item_type', 'episode')->with('user')->orderBy('created_at', 'desc')->get();
     return View::make('items.episode', ['episode' => $episode, 'ratings' => $ratings, 'comments' => $comments]);
 }
开发者ID:thechrisroberts,项目名称:thedoctor,代码行数:7,代码来源:EpisodeController.php

示例3: getArticle

 public function getArticle($id)
 {
     $post = Post::find($id);
     $sidePosts = Post::take(3)->offset(1)->orderby('id', 'desc')->get();
     $comments = Comment::where('post_id', $id)->get();
     return View::make('pages.view')->with(compact('post', 'sidePosts', 'comments'))->with('pageTitle', $post->title);
 }
开发者ID:resethread,项目名称:elycee,代码行数:7,代码来源:BlogController.php

示例4: get

 public function get($id)
 {
     $doctor = Doctor::with(['companions', 'episodes'])->find($id);
     $ratings = Rating::getRating('doctor', $id);
     $comments = Comment::where('item_id', $id)->where('item_type', 'doctor')->with('user')->orderBy('created_at', 'desc')->get();
     return View::make('items.doctor', ['doctor' => $doctor, 'ratings' => $ratings, 'comments' => $comments]);
 }
开发者ID:thechrisroberts,项目名称:thedoctor,代码行数:7,代码来源:DoctorController.php

示例5: showIndex

 public function showIndex()
 {
     if (!Auth::check()) {
         return View::make('login', array('title' => 'edison'));
     }
     $category_names = array('ent' => 'エンターテイメント', 'music' => '音楽', 'sing' => '歌ってみた', 'play' => '演奏してみた', 'dance' => '踊ってみた', 'vocaloid' => 'VOCALOID', 'nicoindies' => 'ニコニコインディーズ', 'animal' => '動物', 'cooking' => '料理', 'nature' => '自然', 'travel' => '旅行', 'sport' => 'スポーツ', 'lecture' => 'ニコニコ動画講座', 'drive' => '車載動画', 'history' => '歴史', 'politics' => '政治', 'science' => '科学', 'tech' => 'ニコニコ技術部', 'handcraft' => 'ニコニコ手芸部', 'make' => '作ってみた', 'anime' => 'アニメ', 'game' => 'ゲーム', 'toho' => '東方', 'imas' => 'アイドルマスター', 'radio' => 'ラジオ', 'draw' => '描いてみた', 'are' => '例のアレ', 'diary' => '日記', 'other' => 'その他', 'r18' => 'R-18', 'original' => 'オリジナル', 'portrait' => '似顔絵', 'character' => 'キャラクター');
     $all_items = Item::orderBy('created_at', 'desc')->take(10)->get();
     foreach ($all_items as &$item) {
         $item['user'] = User::where('id', '=', $item->user_id)->get()[0];
         $item['star_count'] = Starmap::where('item_id', '=', $item->id)->count();
         $item['comment_count'] = Comment::where('item_id', '=', $item->id)->count();
         if ($item->category_id != 0) {
             $item['category'] = Category::where('id', '=', $item->category_id)->get()[0]->content;
         }
     }
     $recent_works = Work::orderBy('created_at', 'desc')->take(10)->get();
     foreach ($recent_works as &$work) {
         $item = Item::where('id', '=', $work->item_id)->get()[0];
         $work['item'] = $item;
         $work['user'] = User::where('id', '=', $work->user_id)->get()[0];
         $work['item_poster_screen_name'] = User::where('id', '=', $item->user_id)->get()[0]->screen_name;
         if ($item->category_id != 0) {
             $work['item_category'] = Category::where('id', '=', $item->category_id)->get()[0]->content;
         }
     }
     $user = User::where('screen_name', '=', Auth::user()->screen_name)->get()[0];
     $data = array('title' => 'edison', 'user' => $user, 'all_items' => $all_items, 'recent_works' => $recent_works, 'categories' => $category_names, 'star_count' => Starmap::where('user_id', '=', $user->id)->count(), 'work_count' => Work::where('user_id', '=', Auth::user()->id)->count());
     return View::make('index', $data);
 }
开发者ID:return-zero,项目名称:ma9,代码行数:29,代码来源:HomeController.php

示例6: store

 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     $input = Input::all();
     $validation = Validator::make($input, Comment::$rules);
     if ($validation->passes()) {
         $last_comment = Comment::where('user_id', '=', Auth::user()->id)->orderBy('created_at', 'desc')->first();
         $current_date = new DateTime(date("Y-m-d H:i:s"));
         if (empty($last_comment)) {
             $interval = 5;
         } else {
             $interval = $current_date->diff($last_comment->created_at);
             $interval = intval($interval->format('%i'));
         }
         if ($interval >= 3) {
             $this->add_daily_comment_points();
             $comment = new Comment();
             $comment->media_id = $input['media_id'];
             $comment->comment = htmlspecialchars($input['comment']);
             $comment->user_id = Auth::user()->id;
             $comment->save();
             echo $comment;
         } else {
             echo 0;
         }
     } else {
         echo 0;
     }
 }
开发者ID:giangcoffee,项目名称:ninja,代码行数:33,代码来源:CommentsController.php

示例7: delete1

 public function delete1($id)
 {
     $regno = Comment::where('id', $id)->first();
     $data = $regno->email;
     //        return $data;
     Comment::destroy($id);
     return Redirect::to('mail')->with('deleted', $data . ' is successFull Deleted from Database');
 }
开发者ID:KornelMbele,项目名称:ResultSystem,代码行数:8,代码来源:MailController.php

示例8: updateComment

 public function updateComment(Comment $comment)
 {
     $comment->approved = Input::get('status');
     $comment->save();
     $comment->post->comment_count = Comment::where('post_id', '=', $comment->post->id)->where('approved', '=', 1)->count();
     $comment->post->save();
     return Redirect::back()->with('success', 'Comment ' . ($comment->approved === 'yes' ? 'Approved' : 'Disapproved'));
 }
开发者ID:Neal-liu,项目名称:neal-liu.github.io,代码行数:8,代码来源:CommentController.php

示例9: updateComment

 public function updateComment(Comment $comment)
 {
     $comment->approved = Input::get('status');
     $comment->save();
     $comment->post->comment_count = Comment::where('post_id', '=', $comment->post->id)->where('approved', '=', 1)->count();
     $comment->post->save();
     return Redirect::back()->withMessage('Commentaire ' . ($comment->approved === 'yes' ? 'approuvé' : 'refusé'));
 }
开发者ID:jeremy6680,项目名称:easy-peasy-cms,代码行数:8,代码来源:CommentController.php

示例10: fire

 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function fire()
 {
     $doc_id = $this->argument('doc_id');
     $filename = $this->argument('filename');
     $doc = Doc::where('id', $doc_id)->first();
     $this->info("Exporting activity for " . $doc->title);
     $annotations = Annotation::where('doc_id', $this->argument('doc_id'))->with('user')->with('comments')->get();
     $comments = Comment::where('doc_id', $this->argument('doc_id'))->with('user')->get();
     $headers = array("Created At", "Link", "Display Name", "Full Name", "Email", "Type", "Quote", "Text");
     $toExport = array();
     foreach ($annotations as $annotation) {
         $annotationArray = array();
         $annotationArray['date'] = $annotation->created_at;
         $annotationArray['link'] = URL::to('/') . $annotation->uri . '#annotation_' . $annotation->id;
         $annotationArray['display_name'] = $annotation->user->fname . " " . substr($annotation->user->lname, 0, 1);
         $annotationArray['full_name'] = $annotation->user->fname . " " . $annotation->user->lname;
         $annotationArray['email'] = $annotation->user->email;
         $annotationArray['type'] = 'Annotation';
         $annotationArray['quote'] = $annotation->quote;
         $annotationArray['text'] = $annotation->text;
         array_push($toExport, $annotationArray);
         foreach ($annotation->comments as $comment) {
             $user = User::find($comment->user_id);
             $commentArray = array();
             $commentArray['date'] = $comment->created_at;
             $commentArray['link'] = "";
             $commentArray['display_name'] = $user->fname . " " . substr($user->lname, 0, 1);
             $commentArray['full_name'] = $user->fname . " " . $user->lname;
             $commentArray['email'] = $user->email;
             $commentArray['type'] = "Annotation Comment";
             $commentArray['quote'] = "";
             $commentArray['text'] = $comment->text;
             array_push($toExport, $commentArray);
         }
     }
     foreach ($comments as $comment) {
         $commentArray = array();
         $commentArray['date'] = $comment->created_at;
         $commentArray['link'] = "";
         $commentArray['display_name'] = $comment->user->fname . " " . substr($comment->user->lname, 0, 1);
         $commentArray['full_name'] = $comment->user->fname . " " . $comment->user->lname;
         $commentArray['email'] = $comment->user->email;
         $commentArray['type'] = $comment->parent_id === null ? "Comment" : "Sub-comment";
         $commentArray['quote'] = "";
         $commentArray['text'] = $comment->text;
         array_push($toExport, $commentArray);
     }
     $this->info('Saving export to ' . $filename);
     $fp = fopen($filename, 'w');
     fputcsv($fp, $headers);
     foreach ($toExport as $row) {
         fputcsv($fp, $row);
     }
     fclose($fp);
     $this->info('Done.');
 }
开发者ID:iaincollins,项目名称:madison,代码行数:61,代码来源:ActivityExport.php

示例11: show

 /**
  * Display customer profile
  *
  * @param $profile
  * @return Response
  */
 public function show($profile)
 {
     $p = User::where('profile_url', '=', $profile)->where('approved', '=', '0')->first();
     $page = Page::where('title', '=', 'faq-customer')->first();
     $follow = Follow::where('user', $p->id)->where('hub', '=', 0)->get();
     $follow_hub = Follow::where('user', $p->id)->where('artist', '=', 0)->get();
     $wall = new \Illuminate\Database\Eloquent\Collection();
     $events = new \Illuminate\Database\Eloquent\Collection();
     $comments = Comment::where('user', '=', $p->id)->orderBy('created_at', 'desc')->get();
     $hidden = unserialize(Cookie::get('hide'));
     //dd( Cookie::get('hide') );
     if (count($follow) > 0) {
         foreach ($follow as $f) {
             $s = Song::where('artist', '=', $f->artist)->where('completed', '=', '1')->get();
             $e = ArtistEvent::where('artist', '=', $f->artist)->where('date', '>', \Carbon\Carbon::now())->get();
             $wall = $wall->merge($s);
             $events = $events->merge($e);
         }
     }
     if (count($follow_hub) > 0) {
         foreach ($follow_hub as $h) {
             $hub = Hub::where('id', '=', $h->hub)->first();
             if (!is_null($hub)) {
                 $artists = User::where('type', '=', 'artist')->where('hub', '=', $hub->id)->get();
                 $artists_list = [];
                 $songs = [];
                 $events = [];
                 foreach ($artists as $a) {
                     $artists_list[] = $a->id;
                 }
                 if (count($artists_list) > 0) {
                     $songs = Song::where('completed', '=', '1')->whereIn('artist', $artists_list)->orderBy('created_at', 'desc')->get();
                     $events = ArtistEvent::whereIn('artist', $artists_list)->get();
                 }
                 $news = News::where('hub', '=', $hub->id)->take(3)->get();
                 $wall = $wall->merge($songs);
                 $events = $events->merge($events);
             }
         }
     }
     $purchased = Purchase::where('customer', '=', $p->id)->get();
     foreach ($purchased as $pp) {
         $song_purchased = Song::withTrashed()->where('id', '=', $pp->song)->get();
         $download = Download::where('customer', '=', $p->id)->where('song', '=', $pp->song)->first();
         $song_purchased[0]->purchased = true;
         if (isset($download)) {
             $song_purchased[0]->link = $download->url;
         }
         $wall = $wall->merge($song_purchased);
     }
     $wall->sortByDesc('created_at');
     if (!isset($news)) {
         $news = null;
     }
     return View::make('customer.profile-new', ['profile' => $p, 'wall' => $wall, 'page' => $page, 'events' => $events, 'comments' => $comments, 'hidden' => $hidden, 'news' => $news]);
 }
开发者ID:centaurustech,项目名称:musicequity,代码行数:62,代码来源:CustomerController.php

示例12: my_article_has_comments

function my_article_has_comments()
{
    if (!($itm = Registry::get('article'))) {
        return false;
    }
    $comments = Comment::where('status', '=', 'approved')->where('post', '=', $itm->id)->get();
    $comments = new Items($comments);
    Registry::set('my_article_comments', $comments);
    return $comments->length();
}
开发者ID:aravindanve,项目名称:anchor-maeby-light,代码行数:10,代码来源:functions.php

示例13: viewDetails

 public function viewDetails($id)
 {
     $photo = Photo::find($id);
     if ($photo === null) {
         $error = 'No such photo found.';
         return View::make('errors.error', array('errorMsg' => $error));
     }
     $comments = Comment::where('photo_id', '=', $photo->id)->with('author')->get();
     return View::make('photo.details', array('photo' => $photo, 'comments' => $comments));
 }
开发者ID:renankabal,项目名称:image-manager-system,代码行数:10,代码来源:PhotoController.php

示例14: delete

 /**
  * Override delete method
  * Delete topic itself and all it's comments, ratings, and view counter
  */
 public function delete()
 {
     $tid = $this->id;
     // delete view counter
     Counter::where("[entityId] = ? AND [entityTypeId] = ?", [$tid, Topic::ENTITY_TYPE])->delete();
     Rating::where("[entityId] = ? AND [entityType] = ?", [$tid, Topic::ENTITY_TYPE])->delete();
     RatingStatistic::where("[entityId] = ? AND [entityType] = ?", [$tid, Topic::ENTITY_TYPE])->delete();
     Comment::where("[topicId] = ?", $tid)->delete();
     parent::delete();
 }
开发者ID:a4501150,项目名称:FDUGroup,代码行数:14,代码来源:Topic.php

示例15: show

 public function show($conversation)
 {
     $user = Confide::user();
     $comments = Comment::where('conversation_id', '=', $conversation->id)->orderBy('created_at', 'asc')->get();
     $conversation->sender = User::find($conversation->sender);
     $conversation->receiver = User::find($conversation->receiver);
     foreach ($comments as $comment) {
         $comment->user = User::find($comment->user_id);
     }
     return View::make('home/conversation/show', compact('user', 'conversation', 'comments'));
 }
开发者ID:carlosqueiroz,项目名称:medical-management-system,代码行数:11,代码来源:ConversationController.php


注:本文中的Comment::where方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。