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); }
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 :-)"]); }
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')); }
public function run() { $faker = Faker::create(); foreach (range(1, 10) as $index) { Comment::create([]); } }
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.')); }
public function test_delete_comment() { $comment = Comment::create($this->paramarray); $id = $comment->id; $comment->delete(); $this->assert_false(Comment::get($id)); }
/** * 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')); }
/** * 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(); }
protected function getOrCreateComment($wordpressID) { if ($wordpressID && ($comment = Comment::get()->filter(array('WordpressID' => $wordpressID))->first())) { return $comment; } return Comment::create(); }
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); }
public function add_comment($author_name, $content) { try { Comment::create($this->_id, $author_name, $content); } catch (Exception $e) { die($e->getMessage()); } }
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)); } }
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" => "*****@*****.**")); $page->Comments[] = Comment::create(array("text" => "muj jiný názor", "name" => "Honza", "mail" => "*****@*****.**")); $page->save(); $this->assertEquals(2, count(Page::findByName("English article")->Comments)); }
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)); }
/** * 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); }
public function doSubmit($data, $form) { $comment = Comment::create(); $form->saveInto($comment); $comment->PostID = $this->owner->ID; $comment->write(); $this->owner->redirectBack(); }
public function run() { $faker = Faker::create(); Comment::truncate(); $posts = Post::all(); foreach (range(1, 50) as $index) { Comment::create(['user_id' => $faker->numberBetween($min = 1, $max = 10), 'post_id' => rand(1, $posts->count()), 'text' => $faker->paragraph($nbSentences = 3), 'attachment_id' => 0]); } }
function create_comment($entry, $attributes) { $recaptcha_response = recaptcha_check_answer(RECAPTCHA_PRIVATE_KEY, $_SERVER["REMOTE_ADDR"], $attributes["recaptcha_challenge_field"], $attributes["recaptcha_response_field"]); if ($recaptcha_response->is_valid && Comment::create($entry, $attributes['body'], $attributes['author'], $_SERVER['REMOTE_ADDR'])) { render_entry($entry); } else { render_entry($entry, $attributes, $recaptcha_response->error); } }
public function run() { $faker = Faker::create(); $users = User::lists('id'); $posts = Post::lists('id'); foreach (range(1, 100) as $index) { Comment::create(['body' => $faker->sentence(), 'user_id' => $faker->randomElement($users), 'post_id' => $faker->randomElement($posts)]); } }
public function run() { $faker = Faker::create(); // clear all data DB::table('comments')->truncate(); foreach (range(1, 20) as $index) { Comment::create(['id' => $index, 'name' => 'DummyUser' . $index, 'email' => 'DummyUser' . $index . '@Dummy.com', 'content' => 'DummyContentDummyContent' . $index, 'post_id' => rand(1, 10), 'created_at' => date('Y-m-d H:i:s'), 'updated_at' => date('Y-m-d H:i:s')]); } }
public function comment($title, $content, User $user) { $key = camel2under(get_called_class()); $info = compact('user', 'title', 'content'); $info[$key] = $this; $c = Comment::create($info); $this->update(array('touched=NOW()' => null)); return $c; }
/** * 填充评论数据 * @return void */ private function seedComment() { Comment::truncate(); // 清空表 for ($i = 1; $i < 30; $i++) { Comment::create(array('user_id' => $i, 'article_id' => 1 + $i % 5 + 28, 'content' => '评论内容' . $i)); Article::find(1 + $i % 5 + 28)->increment('comments_count'); } $this->command->info('随机评论数据填充完毕'); }
/** * Store a newly created resource in storage. * @return Response */ public function store() { $datas = Input::all(); $validator = Validator::make($datas, Comment::$rules); if ($validator->fails()) { return Redirect::back()->withErrors($validator)->withInput()->with("error", "Oops Something Wrong"); } Comment::create($datas); return Redirect::back()->with('success', 'Thanks for your comment'); }
public function handleComment($data, $form) { $comment = Comment::create(); $comment->Name = $data['Name']; $comment->Comment = $data['Comment']; $comment->ParentID = $this->ID; $comment->write(); $form->sessionMessage('Thanks for your comment!', 'good'); return $this->redirectBack(); }
public function run() { DB::table('comments')->delete(); Comment::create(array('text' => 'Great Post, Thanks!', 'post_id' => 1, 'user_id' => 1)); Comment::create(array('text' => 'Great Post, Thanks!', 'post_id' => 1, 'user_id' => 2)); Comment::create(array('text' => 'Great Post, Thanks!', 'post_id' => 2, 'user_id' => 1)); Comment::create(array('text' => 'Great Post, Thanks!', 'post_id' => 2, 'user_id' => 2)); Comment::create(array('text' => 'Great Post, Thanks!', 'post_id' => 3, 'user_id' => 1)); Comment::create(array('text' => 'Great Post, Thanks!', 'post_id' => 3, 'user_id' => 2)); }
public function add_comment() { if (!isset($_POST['comment']) || !isset($_POST['image_id'])) { return call('pages', 'error'); } require_once 'models/comment.php'; Comment::create($_POST['image_id'], $_POST['comment']); $_SESSION['notice'] = "Comments saved successfully"; redirect_to('images', 'show/' . $_POST['image_id']); }
protected function tree($depth, $post_id, $parent_id, $time) { if (rand(0, 20) < $depth + 1) { return; } while (rand(0, 1) != 1) { $time = $time + rand(0, 100); $comment = Comment::create(['post_id' => $post_id, 'parent_id' => $parent_id, 'user_id' => rand(1, 100), 'created_at' => $time, 'updated_at' => $time, 'data' => $this->faker->paragraph, 'markdown' => '', 'upvotes' => 0, 'downvotes' => 0]); $this->tree($depth + 1, $post_id, $comment->id, $time + rand(0, 1000)); } }
/** * Store a newly created comment in storage. * * @return Response */ public function store($admin) { $validator = Validator::make($data = Input::all(), Comment::$rules); if ($validator->fails()) { return Redirect::back()->withErrors($validator)->withInput(); } Comment::create($data); $comment = Comment::whereUserName($admin)->first(); dd($comment); return Redirect::route('admin.subjects.show', compact('admin', 'comment')); }
public function store() { $validator = Validator::make($data = Input::all(), Comment::$rules); if ($validator->fails()) { return Redirect::back()->withErrors($validator)->withInput(); } $data['user_id'] = Auth::user()->id; $comment = Comment::create($data); $comment->post->increment('comments_count', 1); Flash::success(lang('Operation succeeded.')); return Redirect::route('posts.show', [$comment->post->id, '#comment-input']); }
public function post_add() { $id = Input::get('id'); //Find the id of the post $post = Post::find($id); $validation = Comment::validate(Input::all()); if ($validation->fails()) { return Redirect::to_route('post_view', $post->slug)->with_errors($validation)->with_input(); } else { Comment::create(array('user' => Input::get('user'), 'post_id' => Input::get('id'), 'comment_msg' => Input::get('comment_msg'))); return Redirect::to_route('post_view', $post->slug)->with('message', 'Comment Posted successfully!'); } }