コード例 #1
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $faker = Faker::Create();
     foreach (range(1, 10) as $seededItem) {
         User::create(['first_name' => $faker->name, 'last_name' => $faker->name, 'password' => Hash::make('123456'), 'type' => false, 'sex' => $faker->boolean(), 'email' => $faker->email, 'date_of_birth' => $faker->date('Y-m-d')]);
     }
     $users = User::all()->lists('id')->toArray();
     foreach (range(1, 100) as $seededItem) {
         Post::create(['user_id' => $faker->randomElement($users), 'body' => $faker->text, 'vote_count' => 0]);
     }
     $posts = Post::all()->lists('id')->toArray();
     Comment::create(['user_id' => $faker->randomElement($users), 'body' => $faker->text, 'vote_count' => 0, 'parent_id' => null]);
     foreach (range(1, 100) as $seededItem) {
         Post_Vote::create(['user_id' => $faker->randomElement($users), 'post_id' => $faker->randomElement($posts), 'up' => $faker->boolean()]);
         Comment::create(['user_id' => $faker->randomElement($users), 'parent_id' => $faker->randomElement(Comment::all()->lists('id')->toArray()), 'post_id' => $faker->randomElement($posts), 'body' => $faker->text, 'vote_count' => 0]);
         Tag::create(['name' => $faker->text, 'private' => $faker->boolean()]);
     }
     $comments = Comment::all()->lists('id')->toArray();
     $tags = Tag::all()->lists('id')->toArray();
     foreach (range(1, 100) as $seededItem) {
         Comment_Vote::create(['user_id' => $faker->randomElement($users), 'comment_id' => $faker->randomElement($comments), 'up' => $faker->boolean()]);
         Tag_User::create(['user_id' => $faker->randomElement($users), 'tag_id' => $faker->randomElement($tags)]);
         Post_Tag::create(['tag_id' => $faker->randomElement($tags), 'post_id' => $faker->randomElement($posts)]);
     }
 }
 public function run()
 {
     DB::table('comments')->delete();
     Comment::create(['author' => '山本さん', 'text' => '今日は良い天気ですね']);
     Comment::create(['author' => '山田さん', 'text' => 'お久しぶりです']);
     Comment::create(['author' => '竹下さん', 'text' => '便利ですね。']);
 }
コード例 #3
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $this->validate($request, ['content' => 'required']);
     $input = $request->all();
     Comment::create(array_merge($input, ['user_id' => Auth::user()->id]));
     return redirect(url('articles', $input['article_id']));
 }
コード例 #4
0
 /**
  * Store a newly created resource in storage.
  * @param CreateCommentRequest $request
  * @return \Illuminate\Http\Response
  */
 public function store(CreateCommentRequest $request)
 {
     //validation
     //$input = Request::all();
     Comment::create($request->all());
     return redirect('comment');
 }
コード例 #5
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     //
     $comment = Request::all();
     Comment::create($comment);
     return redirect('threadforum.comment');
 }
コード例 #6
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(CommentRequest $request)
 {
     Comment::create($request->all());
     // return view('prayers.show');
     // return \Redirect::back()->with('message','Comment saved.');
     return redirect('prayers');
 }
コード例 #7
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 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'));
 }
コード例 #8
0
 public function store(BookingRequest $request)
 {
     $booking = array('car_type_id' => $request->car_type_id, 'number_of_passengers' => $request->number_of_passengers, 'pickup_time' => $request->pickup_date_part . ' ' . $request->pickup_time_part, 'ip_info' => $request->ip_info);
     $newBooking = Booking::create($booking);
     flash()->success('Your booking has been created!')->important();
     if (!empty($request->comment1)) {
         //children comment
         $comment1 = array('booking_id' => $newBooking->id, 'comment_type_id' => '1', 'role_id' => '1', 'comment' => $request->comment1);
         Comment::create($comment1);
     }
     if (!empty($request->comment2)) {
         //general comment
         $comment2 = array('booking_id' => $newBooking->id, 'comment_type_id' => '2', 'role_id' => '1', 'comment' => $request->comment2);
         Comment::create($comment2);
     }
     $change = array('booking_id' => $newBooking->id, 'change_type_id' => '4', 'user_id' => Auth::user()->id, 'from' => null, 'to' => null);
     Change::create($change);
     $passenger = User::firstOrNew(['email' => $request->email]);
     $passenger->name = $request->name;
     $passenger->phone = $request->phone;
     $passenger->save();
     $role = array('booking_id' => $newBooking->id, 'role_type_id' => '2', 'user_id' => $passenger->id);
     Role::create($role);
     $price = array('booking_id' => $newBooking->id, 'income_type_id' => '1', 'amount_eur' => $request->price);
     Income::create($price);
     $locationArray = $request->location;
     foreach ($request->address as $order => $address_id) {
         $route_point = null;
         $route_point = array('booking_id' => $newBooking->id, 'location_id' => $locationArray[$order], 'address_id' => $address_id, 'order' => $order);
         Route_point::create($route_point);
     }
     return redirect('bookings');
 }
コード例 #9
0
 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()]);
 }
コード例 #10
0
 /**
  * Run the migrations.
  *
  * @return void
  */
 public function up()
 {
     $u = User::create(['first_name' => 'test', 'last_name' => 'test', 'email' => '*****@*****.**', 'level' => 1]);
     $u2 = User::create(['first_name' => 'test2', 'last_name' => 'test2', 'email' => '*****@*****.**', 'level' => 1]);
     $u3 = User::create(['first_name' => 'test3', 'last_name' => 'test3', 'email' => '*****@*****.**', 'level' => 2]);
     $e1 = Event::create(['name' => 'test event', 'user_id' => 3, 'slug' => 'test-event-1', 'date' => '2016-10-17', 'start' => '18:00:00', 'end' => '5:00:00']);
     $e2 = Event::create(['name' => 'test event', 'user_id' => 1, 'slug' => 'test-event-2', 'date' => '2016-08-22', 'start' => '19:00:00', 'end' => '5:00:00']);
     Event::create(['name' => 'test event', 'user_id' => 2, 'slug' => 'test-event-3', 'date' => '2017-01-07', 'start' => '18:00:00', 'end' => '5:00:00']);
     $p1 = Playlist::create(['name' => 'Playlist principale !']);
     $p2 = Playlist::create(['name' => 'The Playlist !']);
     $p3 = Playlist::create(['name' => 'Playlist secondaire']);
     Playlist::create(['name' => 'The Playlist !']);
     $p1->styles()->sync([1, 2, 3]);
     $p2->styles()->sync([1, 4]);
     $p3->styles()->sync([1, 3, 5, 7]);
     $e1->playlists()->sync([1, 3]);
     $e2->playlists()->sync([2]);
     Comment::create(['event_id' => 2, 'user_id' => 2, 'content' => 'Sooo goooood']);
     Comment::create(['event_id' => 3, 'user_id' => 2, 'content' => 'Sooo goooood :D']);
     Comment::create(['event_id' => 2, 'user_id' => 3, 'content' => 'Sooo goooood !!!']);
     Video::create(['url' => '7l48bfQuJeE', 'artist' => 'Chill Bump', 'name' => 'Lost In The Sound', 'tags' => 'chill bump lost in the sound']);
     Video::create(['url' => 'XxdPJvhQaMU', 'artist' => 'Chill Bump', 'name' => 'Water boycotter', 'tags' => 'chill bump water boycotter']);
     Video::create(['url' => 'kWXAYDQ_K7k', 'artist' => 'Chill Bump', 'name' => 'The Memo', 'tags' => 'chill bump the memo']);
     $pivot1 = $p1->videos()->sync([1, 3]);
     $pivot2 = $p2->videos()->sync([2]);
     $pivot3 = $p3->videos()->sync([1, 2, 3]);
     News::create(['title' => 'news test', 'content' => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. ', 'user_id' => 2, 'slug' => 'text-news-1']);
     News::create(['title' => 'news test 2', 'content' => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. ', 'user_id' => 3, 'slug' => 'text-news-2']);
     Article::create(['title' => 'Article test 1', 'content' => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. ', 'user_id' => 2, 'slug' => 'text-article-1']);
     Article::create(['title' => 'Article test 2', 'content' => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. ', 'user_id' => 3, 'slug' => 'text-article-2', 'event_id' => 2]);
 }
コード例 #11
0
ファイル: CommentController.php プロジェクト: misterebs/cmsku
 public function store(Request $request)
 {
     $article = Article::find($request->article_id);
     if (empty($article)) {
         return response()->json(['status' => 404, 'msg' => '文章不存在']);
     }
     if (!$article->comment_status) {
         return response()->json(['status' => 403, 'msg' => '文章已禁用评论']);
     }
     $rules = array('body' => 'required');
     $validation = Validator::make($commentData = $request->all(), $rules);
     if ($validation->fails()) {
         return response()->json(['status' => 0, 'msg' => '评论内容不能为空']);
     }
     $user = Auth::user();
     $commentData['user_id'] = $user->id;
     $parsedComment = parseAt($commentData['body']);
     $atUidArr = $parsedComment['uidArr'];
     $commentData['body'] = Markdown::parse($parsedComment['comments']);
     $comment = Comment::create($commentData);
     $html = view('articles._comment', compact('comment'))->render();
     $comment->article->increment('comment_count');
     $user->histories()->create(['type' => 'comment', 'content' => '评论文章《<a href="/article/' . $article->id . '#comment-' . $comment->id . '" target="_blank">' . $article->title . '</a>》']);
     Notify::notify([$article->user_id], '<a href="/user/' . $user->id . '" target="_blank">' . $user->name . '</a> 评论了您的文章 <a href="/article/' . $article->id . '#comment-' . $comment->id . '" target="_blank">' . $article->title . '</a>', 'comment');
     if ($atUidArr) {
         Notify::notify($atUidArr, '<a href="/user/' . $user->id . '" target="_blank">' . $user->name . '</a> 在文章 <a href="/article/' . $article->id . '#comment-' . $comment->id . '" target="_blank">' . $article->title . '</a> 的评论中提到了您', 'comment');
     }
     return response()->json(['status' => 200, 'msg' => '评论成功', 'html' => $html]);
 }
コード例 #12
0
 public function comment($id, Request $request)
 {
     $post = \App\Post::find($id);
     $comment = \App\Comment::create($request->all());
     $post->comments()->save($comment);
     return redirect()->route('posts.show', $post->id);
 }
コード例 #13
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     //
     for ($i = 1; $i < 50; $i++) {
         Comment::create(['user_id' => rand(1, 30), 'post_id' => rand(1, 50), 'body' => 'comment body' . $i, 'status' => 1]);
     }
 }
コード例 #14
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  Request  $request
  * @return Response
  */
 public function store(Requests\StoreCommentRequest $request)
 {
     if (Comment::create($request->all())) {
         return Redirect::back();
     } else {
         return Redirect('/');
     }
 }
コード例 #15
0
ファイル: CommentsController.php プロジェクト: anrito/video
 public function store(Request $request)
 {
     $user_id = User::find(1);
     $video_id = $request->input('video_id');
     $text = $request->input('message');
     Comment::create(['user_id' => $user_id->id, 'video_id' => $video_id, 'text' => $text]);
     return redirect()->back();
 }
コード例 #16
0
 /**
  * Store a newly created comment in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(CommentFormRequest $request)
 {
     $input = $request->all();
     //dd($input);
     Comment::create($input);
     Session::flash('flash_message', 'Váš komentář byl přidán.');
     return redirect()->back();
 }
コード例 #17
0
ファイル: CommentTableSeeder.php プロジェクト: kaeku/openzou
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     DB::table('comments')->delete();
     $newsId = DB::table('news')->first()->id;
     Comment::create(['content' => 'Testcomment 1', 'state' => 'angelegt', 'news_id' => $newsId]);
     $commentId = DB::table('comments')->first()->id;
     Comment::create(['content' => 'Testcomment 2', 'state' => 'angelegt', 'news_id' => $newsId, 'reply_to' => $commentId]);
 }
コード例 #18
0
 public function commentToClassX(Request $request)
 {
     onlyAllowPostRequest($request);
     $all = $request->only(['post_id', 'author_id', 'content']);
     $comment = Comment::create(['post' => intval($all['post_id']), 'author' => intval($all['author_id']), 'content' => $all['content']]);
     $c = Comment::getCommentInfoById($comment->id);
     return response()->json($c);
 }
コード例 #19
0
ファイル: IncidentController.php プロジェクト: elcuy/Support
 public function closeIncident($incidentId, Request $request)
 {
     $incident = Incident::find($incidentId);
     $incident->update(['status' => 'closed', 'closed_at' => date('Y-m-d h:i:s')]);
     Comment::create(['incident_id' => $incident->id, 'comment' => 'Cierre de incidente: ' . $request->input('comment'), 'user_id' => Auth::user()->id]);
     $request->session()->flash('alert-success', 'El incidente número <strong>' . $incident->id . '</strong> ha sido cerrado con éxito');
     return redirect('/dashboard');
 }
コード例 #20
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Comment::truncate();
     $faker = Faker::create('zh_TW');
     foreach (range(1, 20) as $id) {
         Comment::create(['name' => $faker->name, 'email' => $faker->email, 'content' => $faker->paragraph, 'post_id' => rand(1, 20), 'created_at' => Carbon::now()->subDays(20 - $id), 'updated_at' => Carbon::now()->subDays(20 - $id)]);
     }
 }
コード例 #21
0
 public function store(Request $request, $id)
 {
     $user = \Auth::user();
     $input = Request::all();
     $forms = Form::findorfail($id);
     Comment::create(['content' => $input['content'], 'user_id' => $user->id, 'form_id' => $forms->id]);
     return redirect(url('/form', $id));
 }
コード例 #22
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $video = Video::find(1);
     for ($i = 1; $i <= 3; $i++) {
         $data = ['user_id' => User::find($i)->id, 'video_id' => $video->id, 'comment' => 'Lorem ipsum comment'];
         Comment::create($data);
     }
 }
コード例 #23
0
 public function newComment(CommentFormRequest $request, Comment $comment)
 {
     //ONE WAY - OK
     $request = $request->all();
     $request['user_id'] = \Auth::id();
     Comment::create($request);
     return redirect()->back()->with('status', 'Your comment has been created!');
 }
コード例 #24
0
ファイル: CommentController.php プロジェクト: enhive/vev
 public function store(Request $request, Post $post)
 {
     $comment = Comment::create($request->all());
     $post->comments()->save($comment);
     Score::create(['user_id' => Auth::user()->id, 'reference' => 'comment', 'score' => 2]);
     Auth::user()->increment('scores', 2);
     return redirect()->to('posts/' . $post->slug);
 }
コード例 #25
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $json = File::get(storage_path() . '/jsondata/comments.json');
     $data = json_decode($json);
     foreach ($data as $obj) {
         Comment::create(array('id' => $obj->id, 'car_id' => $obj->car_id, 'body' => $obj->body));
     }
 }
コード例 #26
0
ファイル: CommentTableSeeder.php プロジェクト: y850830/orm
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Comment::truncate();
     $faker = Factory::create('zh_TW');
     foreach (range(1, 15) as $number) {
         Comment::create(['name' => $faker->name, 'email' => $faker->email, 'content' => $faker->paragraph, 'post_id' => rand(1, 10)]);
     }
 }
コード例 #27
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $this->validate($request, ["content" => "required|min:3", "visibility_id" => "required|exists:categories,id", "feedback_id" => "required|exists:feedbacks,id"]);
     $data = $request->all();
     $data['user_id'] = \Auth::user() ? \Auth::user()->id : 1;
     $comment = Comment::create($data);
     return redirect(route('backend.feedbacks.comments', $request->get('feedback_id')));
 }
コード例 #28
0
 public function store(Request $request)
 {
     //echo $_POST[''];
     Comment::create(['author' => $request->author, 'text' => $request->text]);
     //echo $request;
     //echo $request->author;
     //return ($request->author);
 }
コード例 #29
0
 public function store()
 {
     if (Comment::create(Input::all())) {
         return Redirect::back();
     } else {
         return Redirect::back()->withInput()->withErrors('评论发表失败!');
     }
 }
コード例 #30
0
 public function store(Request $request)
 {
     $data = $request->all();
     $data['friend_id'] = \Auth::user()->id;
     unset($data['_token']);
     Comment::create($data);
     return redirect("users/{$request->user_id}");
 }