• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP app\Comment类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: newComment

 /**
  * Show the form for creating a new resource.
  *
  * @return Response
  */
 public function newComment(CommentFormRequest $request)
 {
     $user_id = Auth::user()->id;
     $comment = new Comment(array('post_id' => $request->get('post_id'), 'content' => $request->get('content'), 'user_id' => $user_id));
     $comment->save();
     return redirect()->back()->with('custom_success', 'Your comment has been created!');
 }
开发者ID:ErtyGi,项目名称:wsapp,代码行数:12,代码来源:CommentsController.php


示例2: store

 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(Request $request)
 {
     $comentario = new Comment($request->all());
     //        dd($comentario);
     $comentario->save();
     return redirect()->back();
 }
开发者ID:RudyEscalera,项目名称:examenfinal,代码行数:12,代码来源:CommentsController.php


示例3: destroy

 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy(Comment $comment)
 {
     $comment->deleted_at = \Carbon\Carbon::now();
     if ($comment->save()) {
         return $this->respondWithItem($comment, new CommentTransformer());
     }
 }
开发者ID:jasonb8293,项目名称:fox-api,代码行数:13,代码来源:CommentController.php


示例4: postComment

 public function postComment(Category $category, Post $post, CommentRepository $repository, PostNewComment $request, Comment $comment)
 {
     $fields = array_merge($request->all(), array('post_id' => $post->id));
     $comment->create($fields);
     Session::flash('success', 'Comment added succesfully !');
     return view('blog.post', ['post' => $post, 'categories' => $category->all()]);
 }
开发者ID:bigpaulie,项目名称:demo-laravel-blog,代码行数:7,代码来源:BlogController.php


示例5: saveComment

 public function saveComment(Request $request)
 {
     $validator = Validator::make($request->all(), ['name' => 'required|min:3|max:60', 'email' => 'required|min:8|max:60', 'comment' => 'required|min:5|max:2000', 'equal' => 'required|min:1|max:2']);
     if ($validator->fails()) {
         return redirect()->back()->withErrors($validator)->withInput();
     }
     list(, $first_number) = explode('_', $request->type_1);
     list(, $second_number) = explode('_', $request->type_2);
     $equal = (int) $first_number + (int) $second_number;
     if ($equal != $request->equal) {
         return redirect()->back()->withErrors(['Уравнение не верно!'])->withInput();
     }
     $url = explode('/', URL::previous());
     $id = end($url);
     if ($request->id === $id and $request->type === 'post') {
         $comment = new Comment();
         $comment->parent_id = $request->id;
         $comment->parent_type = 'App\\Post';
         $comment->name = $request->name;
         $comment->email = $request->email;
         $comment->comment = $request->comment;
         $comment->save();
         return redirect()->back()->with('status', 'Комментарии добавлен!');
     } else {
         return redirect()->back()->with('status', 'Ошибка!');
     }
 }
开发者ID:vizovteam,项目名称:vizov,代码行数:27,代码来源:CommentController.php


示例6: store

 public function store(Requests\SaveCommentRequest $request, $offer_id)
 {
     $offer = Offer::findOrFail($offer_id);
     if (Gate::denies('add-comment', $offer)) {
         abort(403);
     }
     $comment = new Comment();
     $comment->fill($request->input());
     $comment->user_id = Auth::user()->id;
     $comment->offer_id = $offer_id;
     $comment->save();
     $violation = $offer->violation;
     // Send email
     $user_type = Auth::user()->getOriginal('user_type');
     if ($user_type == 'cus') {
         $to = $offer->author->username;
         $email = $offer->author->email;
     } else {
         $to = $violation->author->username;
         $email = $violation->author->email;
     }
     $poster_name = Auth::user()->username;
     $address = $violation_name = $violation->address1 . ', ' . $violation->city . ' (' . $violation->getOriginal('state') . ') ' . $violation->zip;
     $data = compact('user_type', 'to', 'poster_name', 'address', 'offer_id');
     Mail::send('emails.newcomment', $data, function ($message) use($email) {
         $message->subject('New Comment Posted');
         $message->to($email);
     });
     // Flash message
     Session::flash('message', 'Your comment has been posted to the offer.');
     Session::flash('message-type', 'success');
     // Redirect
     return redirect(url('/offer/' . $offer_id . '#comment_' . $comment->id));
 }
开发者ID:softelos,项目名称:app.buildingviolation.com,代码行数:34,代码来源:CommentController.php


示例7: show

 public function show($id)
 {
     $article = Article::find($id);
     $user = User::find($article->user_id);
     $comment = new Comment();
     $comments = $comment->orderBy('updated_at', 'desc')->with('user')->get();
     return view('articles.show', compact('article', 'user', 'comments'));
 }
开发者ID:cihannalp,项目名称:Laravel-Blog,代码行数:8,代码来源:ArticleController.php


示例8: create_cmt

 /**
  * Function create comment
  * @author  Tran Van Moi <[[email protected]]>
  * @since  2015/05/13
  * @param  string $content
  * @param  int $post_id
  * @return object
  */
 public static function create_cmt($content, $post_id)
 {
     $cmt = new Comment();
     $cmt->user_id = Auth::user()->id;
     $cmt->post_id = $post_id;
     $cmt->content = $content;
     $cmt->save();
     return $cmt;
 }
开发者ID:ambarsetyawan,项目名称:laravel-1,代码行数:17,代码来源:Comment.php


示例9: saveComment

 public function saveComment(Request $request)
 {
     $comment = new Comment();
     $comment->message = $request->input('message');
     $comment->post_id = $request->input('post_id');
     $comment->user_id = Auth::id();
     $comment->save();
     return response()->json($comment);
 }
开发者ID:sukruthmk,项目名称:cast,代码行数:9,代码来源:CommentController.php


示例10: store

 public function store(Request $request)
 {
     \Log::info($request->input('author'));
     $comment = new Comment();
     $comment->content = $request->input('content');
     $comment->author = $request->input('author');
     $comment->save();
     return $comment->toArray();
 }
开发者ID:HoangTuBe,项目名称:react,代码行数:9,代码来源:CommentController.php


示例11: comment

 public function comment(CommentRequest $request)
 {
     $comment = new Comment();
     $comment->user_id = Auth::user()->id;
     $comment->lecture_id = $request->id;
     $comment->comment = $request->comment;
     $comment->save();
     return redirect::back();
 }
开发者ID:DarkBlackJPG,项目名称:Learn_ON-1,代码行数:9,代码来源:CoursesController.php


示例12: saveComment

 public function saveComment(Request $request, $id)
 {
     $article = Article::findOrFail($id);
     $comment = new Comment($request->all());
     $comment->user_id = Auth::user()->id;
     $comment->article_id = $id;
     $comment->save();
     return redirect('articles/' . $id);
 }
开发者ID:pexea12,项目名称:uethackathon2015_team10server,代码行数:9,代码来源:ArticlesController.php


示例13: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  Request  $request
  * @return Response
  */
 public function store(Request $request)
 {
     //
     $comment = new Comment();
     $comment->author = $request->input("author");
     $comment->comment = $request->input("comment");
     $comment->save();
     return $comment;
 }
开发者ID:berkayk,项目名称:react-laravel-comment-demo-app,代码行数:15,代码来源:CommentController.php


示例14: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $comment = new Comment();
     $comment->c_email = $request->email;
     $comment->c_message = $request->message;
     $comment->post_id = $request->idPost;
     $comment->c_spam = 0;
     $comment->save();
     return redirect()->back()->withInput();
 }
开发者ID:vincentdeletang,项目名称:School,代码行数:16,代码来源:CommentController.php


示例15: store

 public function store(Request $request)
 {
     $rules = ['author' => 'required|max:50', 'text' => 'required|unique:comments,text|max:255'];
     $this->validate($request, $rules);
     $comment = new Comment();
     $comment->author = $request->author;
     $comment->text = $request->text;
     $comment->save();
     return $comment;
 }
开发者ID:bagaimana-cara-membuat,项目名称:react-realtime-comment-box,代码行数:10,代码来源:CommentController.php


示例16: newComment

 public function newComment(CommentFormRequest $request)
 {
     $content = $request->get('content');
     $content = preg_replace('/ /', '&nbsp', $content);
     $content = preg_replace('/\\n/', '<br>', $content);
     $comment = new Comment(array('post_id' => $request->get('post_id'), 'content' => $content));
     $comment->save();
     //        return redirect()->back()->with('status', 'Your comment has been created!');
     return redirect()->to(URL::previous() . "#comment");
 }
开发者ID:weiyeu,项目名称:laravel_date,代码行数:10,代码来源:CommentsController.php


示例17: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  Request  $request
  * @return Response
  */
 public function store(Request $request)
 {
     $comment = new Comment();
     $comment->body = $request->body;
     $comment->post_id = $request->post_id;
     $comment->user_id = Auth::user()->id;
     $comment->save();
     $post = Post::where('id', $request->post_id)->get();
     return Redirect($post[0]->community_id . '/post/' . $request->post_id)->with('message', 'Post created');
 }
开发者ID:jakeboyles,项目名称:GuyBuy,代码行数:16,代码来源:CommentController.php


示例18: comments

 /**
  * 评论
  * @return bool
  */
 public function comments(Request $request)
 {
     $comment = new Comment();
     $comment->content = $request->content;
     $comment->message_id = $request->message_id;
     $comment->user_id = Auth::id();
     $comment->message_user_id = Message::find($request->message_id)['user_id'];
     $comment->save();
     return Redirect('/message_info' . '/' . $request->message_id);
 }
开发者ID:babyanzichen,项目名称:--laravel5-----,代码行数:14,代码来源:MessageController.php


示例19: newComment

 public function newComment(Request $request)
 {
     $this->validate($request, ['comment' => 'required|min:2|max:140', 'tweet_id' => 'required|exists:tweets,id']);
     $comment = new Comment();
     $comment->content = $request->comment;
     $comment->user_id = \Auth::user()->id;
     $comment->tweet_id = $request->tweet_id;
     $comment->save();
     // redirects user back to page.
     return back();
 }
开发者ID:hyperspacedisco,项目名称:twitclone,代码行数:11,代码来源:ProfileController.php


示例20: destroy

 public function destroy(Comment $comment)
 {
     if ($comment->user_id != Auth::user()->id && !Entrust::hasRole('admin')) {
         return redirect()->back()->withErrors(config('constants.INVALID_LINK'));
     }
     $belongs_to = $comment->belongs_to;
     $comment->delete();
     $activity = 'Deleted a commented on a ' . ucfirst($belongs_to);
     Activity::log($activity);
     return redirect()->back()->withSuccess(config('constants.DELETED'));
 }
开发者ID:EneaWeb,项目名称:aliangel,代码行数:11,代码来源:CommentController.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP app\Company类代码示例发布时间:2022-05-23
下一篇:
PHP app\Client类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap