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


PHP Comment::where方法代码示例

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


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

示例1: post

 function post($id)
 {
     $data['post'] = Post::find($id);
     $data['comments'] = Comment::where('post_id', '=', $id)->with('user')->get();
     //$data['comments'] = Comment::find($id);
     return view('blog/post', $data);
 }
开发者ID:rahulrockers,项目名称:laravel-demo,代码行数:7,代码来源:UserController.php

示例2: show

 /**
  * Display the specified resource.
  *
  * @param $guildSlug
  * @param $occurrenceId
  * @return \Illuminate\Http\Response
  */
 public function show($guildSlug, $occurrenceId)
 {
     $guild = Guild::where('slug', $guildSlug)->firstOrFail();
     $occurrence = EventOccurrence::with(['event', 'event.guild'])->whereHas('event.guild', function ($query) use($guild) {
         $query->where('id', $guild->id);
     })->findOrFail($occurrenceId);
     $event = $occurrence->event;
     $guild = $event->guild;
     $signups = Signup::where(['event_occurrence_id' => $occurrence->id])->orderBy('created_at')->get();
     $comments = Comment::where(['event_occurrence_id' => $occurrence->id])->orderBy('created_at')->get();
     $character = Character::whereHas('guilds', function ($query) use($guild) {
         $query->where('guilds.id', $guild->id);
     })->where(['user_id' => Auth::user()->id])->firstOrFail();
     $ownSignup = null;
     $isSigned = false;
     foreach ($signups as $signup) {
         if ($signup->character_id == $character->id) {
             $ownSignup = $signup;
             $isSigned = true;
         }
     }
     if ($ownSignup == null) {
         $ownSignup = new Signup();
     }
     $statistic = new \stdClass();
     foreach (['YES', 'MAYBE', 'NO'] as $status) {
         $name = strtolower($status);
         $statistic->{$name} = $signups->filter(function ($signup) use($status) {
             return $signup->status == $status;
         })->count();
     }
     return view('guilds.events.show', compact('occurrence', 'event', 'guild', 'signups', 'comments', 'ownSignup', 'isSigned', 'statistic'));
 }
开发者ID:Kehet,项目名称:wow-calendar,代码行数:40,代码来源:GuildsEventsController.php

示例3: show

 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($id)
 {
     //
     //$comments = DB::table('comments')->where('page_id', $id)->get();
     $comments = Comment::where('page_id', $id)->get();
     return view('admin.comments.show', ['comments' => $comments]);
 }
开发者ID:dmodaii,项目名称:laravel5.1-angular,代码行数:13,代码来源:CommentsController.php

示例4: show

 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($id)
 {
     $task = Task::findOrFail($id);
     $comments = Comment::where('tasks_id', '=', $id)->get();
     return view('tasks.show', array('task' => $task, 'comments' => $comments));
     //
 }
开发者ID:allanesquina,项目名称:laravel-sample,代码行数:13,代码来源:TasksController.php

示例5: index

 public function index(Comment $commentsModel)
 {
     //        $comments = $commentsModel->getPublishedComments();
     $comments = Comment::where('active', '=', 1)->where('published_at', '<=', Carbon::now())->latest('published_at')->simplePaginate(4);
     $comments->setPath('comments')->currentPage();
     return view('comments.comments')->with('comments', $comments);
 }
开发者ID:sashacitylight,项目名称:sashasite,代码行数:7,代码来源:CommentsController.php

示例6: show

 public function show($intelligenceSlug, $tutorialId)
 {
     $intelligence = Intelligence::where('slug', $intelligenceSlug)->firstOrFail();
     $tutorial = Tutorial::where('intelligence_id', $intelligence->id)->findOrFail($tutorialId);
     $comments = Comment::where('tutorial_id', $tutorial->id)->paginate(15);
     return view('intelligence.tutorial.show', compact('intelligence', 'tutorial', 'comments'));
 }
开发者ID:inteligenicasmultiples,项目名称:inteligencias,代码行数:7,代码来源:TutorialController.php

示例7: index

 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index($kdThread)
 {
     //
     $comment = Comment::where('kdThread', '=', $kdThread)->with('threadforum.student', 'threadforum.lecturer', 'student', 'lecturer')->get();
     return view('threadforum.comment.index', compact('comment'));
     // return $comment->toJson();
 }
开发者ID:roardi,项目名称:ForumProject,代码行数:12,代码来源:CommentController.php

示例8: show

 /**
  * Shows the specific user.
  * @param string $username
  * @return Response
  */
 public function show($username)
 {
     $post_upvotes = 0;
     $user = User::where('username', '=', $username)->firstOrFail();
     $user_posts = Post::where('user_id', '=', $user->id)->take(3)->get();
     foreach ($user_posts as $post) {
         $post->username = $user->username;
         $post->comment_count = Comment::where('post_id', '=', $post->id)->count();
         $post->hub_name = Hub::where('id', '=', $post->hub_id)->firstOrFail()->name;
         $post_upvotes = $post_upvotes + (int) $post->upvotes;
         $hub = Hub::find($post->hub_id);
         if (in_array($post->user_id, explode(',', $hub->moderators))) {
             $post->user_is_mod = true;
         } else {
             $post->user_is_mod = false;
         }
         $user = User::find($post->user_id);
         if ($user->is_admin) {
             $post->user_is_admin = true;
         } else {
             $post->user_is_admin = false;
         }
     }
     $comment_upvotes = 0;
     $user_comments = Comment::where('user_id', '=', $user->id)->take(3)->get();
     foreach ($user_comments as $comment) {
         $comment_upvotes = $comment_upvotes + (int) $comment->upvotes;
         $comment->email = md5($user->email);
     }
     return view('user.show', ['user' => $user, 'email' => md5($user->email), 'post_upvotes' => $post_upvotes, 'comment_upvotes' => $comment_upvotes, 'comments' => $user_comments, 'posts' => $user_posts]);
 }
开发者ID:NotBlizzard,项目名称:phoenix,代码行数:36,代码来源:UserController.php

示例9: showProfile

 /**
  * Show the application dashboard to the user.
  *
  * @return Response
  */
 public function showProfile($id)
 {
     $user = User::find($id);
     $posts = Post::where("user_id", $id)->get();
     $comments = Comment::where('user_id', $id)->get();
     return view('user.profile', ['user' => $user, 'comments' => $comments, 'posts' => $posts]);
 }
开发者ID:jakeboyles,项目名称:GuyBuy,代码行数:12,代码来源:UserController.php

示例10: show

 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function show($id)
 {
     $adventure = Adventure::find($id);
     $comments = Comment::where('adventure_id', $id)->get();
     $pictures = Picture::where('adventure_id', $id)->get();
     return view('adventures.show', compact('adventure', 'comments'))->with('pictures', $pictures);
 }
开发者ID:abreban,项目名称:RGU,代码行数:13,代码来源:AdventuresController.php

示例11: showpost

 public function showpost($id)
 {
     //display one post
     $article = Article::findOrFail($id);
     $comment = Comment::where('postid', '=', $id)->get();
     //if (is_null($article)) {  abort(404); }
     return view('articles.show', compact('article', 'comment'));
 }
开发者ID:leloulight,项目名称:bloga,代码行数:8,代码来源:PagesController.php

示例12: index

 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $pre_page = 6;
     $comments = Comment::where('status', '<>', 2)->paginate($pre_page);
     //return view('admin/article/index');
     $comments->setPath('comment');
     return view('admin/comment/index')->with('comments', $comments);
 }
开发者ID:ZHA0NING,项目名称:MyBlog,代码行数:13,代码来源:CommentController.php

示例13: update

 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $commentid
  * @return \Illuminate\Http\Response
  */
 public function update(Request $request, $commentid)
 {
     $reply = new \App\Reply();
     $reply->create(['user_id' => \Auth::user()->id, 'comment_id' => $request['comment_id'], 'comment' => $request['comment']]);
     $comment = \App\Comment::where(['id' => $commentid])->get()->first();
     $comment->reply = $reply;
     return redirect()->back();
 }
开发者ID:KevinElberger,项目名称:middle-earth,代码行数:15,代码来源:CommentsController.php

示例14: getByAdId

 public static function getByAdId($id)
 {
     $comments = Comment::where(['ad_id' => $id, 'answer_to' => null])->join('users', 'comments.author_id', '=', 'users.id')->select(['comments.*', 'users.name as author_name'])->orderBy('comments.created_at')->get();
     foreach ($comments as $comment) {
         $comment->answers = Comment::where('answer_to', $comment->id)->join('users', 'comments.author_id', '=', 'users.id')->select(['comments.*', 'users.name as author_name'])->get();
     }
     return $comments;
 }
开发者ID:elberd,项目名称:maoh,代码行数:8,代码来源:Comment.php

示例15: show

 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function show($id)
 {
     $course = Course::where('id', $id)->orWhere('slug', $id)->firstOrFail();
     $data = Data::where('courseId', $course->id)->where('extension', '!=', 'mp4')->accepted()->get();
     $videos = Data::where('courseId', $course->id)->Where('extension', 'mp4')->accepted()->get();
     $comments = Comment::where('courseId', $course->id)->get();
     return view('courses.show', compact('course', 'comments', 'data', 'videos'));
 }
开发者ID:starkbaum,项目名称:sucon,代码行数:14,代码来源:CoursesController.php


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