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


PHP Comment::create方法代码示例

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


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

示例1: create

 public function create()
 {
     redirect_guest_user(LOGIN_URL);
     $thread = Thread::get(Param::get('thread_id'));
     $page = Param::get('page_next');
     $auth_user = User::getAuthenticated();
     if (!$auth_user) {
         return;
     }
     if ($page == 'create_end') {
         $comment = new Comment();
         $comment->body = trim(Param::get('body'));
         $comment->user_id = $auth_user->id;
         try {
             $comment->create($thread);
             $follow = Follow::getByThreadAndUser($thread->id, $comment->user_id);
             if ($follow) {
                 $thread = Thread::get($thread->id);
                 $last_comment = Comment::getLastInThread($thread);
                 if ($last_comment) {
                     $follow->last_comment = $last_comment->id;
                     $follow->update();
                 }
             }
             redirect(VIEW_THREAD_URL, array('id' => $thread->id));
         } catch (ValidationException $e) {
             $page = 'create';
         }
     } else {
         throw new PageNotFoundException();
     }
     $title = 'Create Comment';
     $this->set(get_defined_vars());
     $this->render($page);
 }
开发者ID:rdaitan,项目名称:dc-board,代码行数:35,代码来源:comment_controller.php

示例2: run

 public function run()
 {
     DB::table('comments')->delete();
     Comment::create(['user_id' => 1, 'entry_id' => 1, 'content' => "A retravailler niveau orthographe !"]);
     Comment::create(['user_id' => 2, 'entry_id' => 1, 'content' => "Nul !"]);
     Comment::create(['user_id' => 1, 'entry_id' => 2, 'content' => "Sympa :-)"]);
 }
开发者ID:CreativeMons,项目名称:creative-city,代码行数:7,代码来源:CommentTableSeeder.php

示例3: run

 public function run()
 {
     DB::table('comments')->delete();
     Comment::create(array('author' => 'Nathanael Smith', 'text' => 'Look this is a new test comment'));
     Comment::create(array('author' => 'D Barksdale', 'text' => 'No, the king stay the king'));
     Comment::create(array('author' => 'Detective Greggs', 'text' => 'If I hear the music I\'m gunna dance'));
 }
开发者ID:nsmith7989,项目名称:spreadsheet,代码行数:7,代码来源:CommentTableSeeder.php

示例4: run

 public function run()
 {
     $faker = Faker::create();
     foreach (range(1, 10) as $index) {
         Comment::create([]);
     }
 }
开发者ID:betancourtfran,项目名称:tep,代码行数:7,代码来源:CommentsTableSeeder.php

示例5: run

 public function run()
 {
     DB::table('comments')->delete();
     Comment::create(array('author' => 'Chris Sevilleja', 'text' => 'Look I am a test comment.'));
     Comment::create(array('author' => 'Nick Cerminara', 'text' => 'This is going to be super crazy.'));
     Comment::create(array('author' => 'Holly Lloyd', 'text' => 'I am a master of Laravel and Angular.'));
 }
开发者ID:elminson,项目名称:laravel-angular-comment-app,代码行数:7,代码来源:CommentTableSeeder.php

示例6: test_delete_comment

 public function test_delete_comment()
 {
     $comment = Comment::create($this->paramarray);
     $id = $comment->id;
     $comment->delete();
     $this->assert_false(Comment::get($id));
 }
开发者ID:habari,项目名称:tests,代码行数:7,代码来源:test_comment.php

示例7: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Eloquent::unguard();
     Comment::create(array('user_id' => 1, 'post_id' => 1, 'body_comment' => 'This is the body for a comment'));
     Comment::create(array('user_id' => 2, 'post_id' => 3, 'body_comment' => 'This is the body for a comment'));
     Comment::create(array('user_id' => 3, 'post_id' => 3, 'body_comment' => 'This is the body for a comment'));
 }
开发者ID:jtaurus,项目名称:jtauri_blog,代码行数:12,代码来源:CommentSeeder.php

示例8: store

 /**
  * Store a newly created resource in storage.
  * POST /comments
  *
  * @return Response
  */
 public function store()
 {
     $data = Input::all();
     $data['users_id'] = Auth::user()->id;
     Comment::create($data);
     return Redirect::back();
 }
开发者ID:andrescoulson,项目名称:ChancesAPI,代码行数:13,代码来源:CommentsController.php

示例9: getOrCreateComment

 protected function getOrCreateComment($wordpressID)
 {
     if ($wordpressID && ($comment = Comment::get()->filter(array('WordpressID' => $wordpressID))->first())) {
         return $comment;
     }
     return Comment::create();
 }
开发者ID:camfindlay,项目名称:silverstripe-wordpressimport,代码行数:7,代码来源:WpImporter.php

示例10: saveComment

 public function saveComment()
 {
     $comment = Comment::create(Input::all());
     $comment->user;
     $comment->qpon;
     $response = array("status" => "OK", "messages" => array("id" => 1, "message" => "Comment was saved succesfully..."), "comment" => $comment->toArray());
     return Response::json($response);
 }
开发者ID:edgarhumberto,项目名称:Prueba,代码行数:8,代码来源:CommentsController.php

示例11: add_comment

 public function add_comment($author_name, $content)
 {
     try {
         Comment::create($this->_id, $author_name, $content);
     } catch (Exception $e) {
         die($e->getMessage());
     }
 }
开发者ID:ralmarri12,项目名称:mudwana,代码行数:8,代码来源:Article.php

示例12: run

 public function run()
 {
     $comment = array('コメントやで', 'コメントだよ', 'コメントでおま', 'コマントなのです!', 'コメント5', 'コメント6', 'コメントやで', 'コメントだよ4', 'コメントでおま4', 'コマントなのです!2', 'コメントだよ2');
     $now = date('Y-m-d H:i:s');
     foreach ($comment as $c) {
         Comment::create(array('user_id' => mt_rand(1, 4), 'item_id' => mt_rand(1, 8), 'comment' => $c, 'created_at' => $now, 'updated_at' => $now));
     }
 }
开发者ID:return-zero,项目名称:ma9,代码行数:8,代码来源:CommentSeeder.php

示例13: testNewRecordWithNewReferenced

 public function testNewRecordWithNewReferenced()
 {
     $page = Page::create(array("name" => "English article", "description" => "Description", "text" => "Text in english.", "allowed" => true));
     $page->Comments[] = Comment::create(array("text" => "muj názor", "name" => "Honza", "mail" => "muj@mail.cz"));
     $page->Comments[] = Comment::create(array("text" => "muj jiný názor", "name" => "Honza", "mail" => "muj@mail.cz"));
     $page->save();
     $this->assertEquals(2, count(Page::findByName("English article")->Comments));
 }
开发者ID:janmarek,项目名称:Ormion,代码行数:8,代码来源:HasManyTest.php

示例14: run

 public function run()
 {
     DB::table('comments')->delete();
     Comment::create(array('content' => '这医生好帅哦,虽然没阿登帅', 'record_id' => 4));
     Comment::create(array('content' => '这医生好帅哦,虽然没阿登帅', 'record_id' => 3));
     Comment::create(array('content' => '这医生好帅哦,虽然没阿登帅', 'record_id' => 2));
     Comment::create(array('content' => '这医生好帅哦,虽然没阿登帅', 'record_id' => 1));
 }
开发者ID:xssworm,项目名称:hospital-register-system,代码行数:8,代码来源:CommentTableSeeder.php

示例15: create

 /**
  * Create and store new comment.
  * 
  * @param  array $data
  * @return \FIIP\Comments\Comment|null
  */
 public function create(array $data)
 {
     $comment = Comment::create($data);
     if (!$comment->id) {
         return null;
     }
     return $this->find($comment->id);
 }
开发者ID:adriancatalinsv,项目名称:fiip,代码行数:14,代码来源:CommentRepository.php


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