public function run() { DB::table('update_records')->delete(); DB::table('view_cache')->delete(); DB::table('posts')->delete(); DB::table('threads')->delete(); ################## Thread::create(['id' => 1, 'thread_id' => 111111111, 'board' => 'a', 'updated_num' => 0, 'views' => '500', 'notice' => null, 'secret' => 'a719c9a1', 'takedown_reason' => null, 'tweeted_at' => null]); Post::create(['chan_id' => 111111111, 'thread_id' => 1, 'original_image_name' => 'Imgur.jpg', 'image_size' => 128000, 'image_width' => '535', 'image_height' => '535', 'thumb_width' => '250', 'thumb_height' => '250', 'image_url' => 'http://i.imgur.com/UmmyTUG.png', 'imgur_hash' => 'something', 'subject' => null, 'name' => 'Anonymous', 'tripcode' => null, 'capcode' => null, 'post_timestamp' => DB::raw('FROM_UNIXTIME(1429902005)'), 'body' => 'What is your movie editing software of choice? Pic related for me, but the things you can do it with are pretty limited. Is there a good (free) alternative for simple video editing?']); Post::create(['chan_id' => 111111112, 'thread_id' => 1, 'subject' => null, 'name' => 'Anonymous', 'tripcode' => null, 'capcode' => null, 'post_timestamp' => DB::raw('FROM_UNIXTIME(1429902005)'), 'body' => 'What is your movie editing software of choice? Pic related for me, but the things you can do it with are pretty limited. Is there a good (free) alternative for simple video editing?']); Post::create(['chan_id' => 111111113, 'thread_id' => 1, 'original_image_name' => 'Imgur 2.jpg', 'image_size' => 34000, 'image_width' => '500', 'image_height' => '466', 'thumb_width' => '116', 'thumb_height' => '125', 'image_url' => 'http://i.imgur.com/w6pQEvY.jpg', 'imgur_hash' => 'something', 'subject' => null, 'name' => 'Anonymous', 'tripcode' => null, 'capcode' => null, 'post_timestamp' => DB::raw('FROM_UNIXTIME(1429902005)'), 'body' => 'What is your movie editing software of choice? Pic related for me, but the things you can do it with are pretty limited. Is there a good (free) alternative for simple video editing?']); Post::create(['chan_id' => 111111114, 'thread_id' => 1, 'subject' => null, 'name' => 'Anonymous', 'tripcode' => null, 'capcode' => null, 'post_timestamp' => DB::raw('FROM_UNIXTIME(1429902005)'), 'body' => 'What is your movie editing software of choice? Pic related for me, but the things you can do it with are pretty limited. Is there a good (free) alternative for simple video editing?']); ################## Thread::create(['id' => 2, 'thread_id' => 222222222, 'board' => 'b', 'updated_num' => 0, 'views' => '555', 'notice' => null, 'secret' => 'a719c9a1', 'takedown_reason' => null, 'tweeted_at' => null]); Post::create(['chan_id' => 222222222, 'thread_id' => 2, 'original_image_name' => 'Imgur.jpg', 'image_size' => 128000, 'image_width' => '535', 'image_height' => '535', 'thumb_width' => '250', 'thumb_height' => '250', 'image_url' => 'http://i.imgur.com/UmmyTUG.png', 'imgur_hash' => 'something', 'subject' => null, 'name' => 'Anonymous', 'tripcode' => null, 'capcode' => null, 'post_timestamp' => DB::raw('FROM_UNIXTIME(1429902005)'), 'body' => 'What is your movie editing software of choice? Pic related for me, but the things you can do it with are pretty limited. Is there a good (free) alternative for simple video editing?']); Post::create(['chan_id' => 222222223, 'thread_id' => 2, 'subject' => null, 'name' => 'Anonymous', 'tripcode' => null, 'capcode' => null, 'post_timestamp' => DB::raw('FROM_UNIXTIME(1429902005)'), 'body' => 'What is your movie editing software of choice? Pic related for me, but the things you can do it with are pretty limited. Is there a good (free) alternative for simple video editing?']); Post::create(['chan_id' => 222222224, 'thread_id' => 2, 'original_image_name' => 'Imgur 2.jpg', 'image_size' => 34000, 'image_width' => '500', 'image_height' => '466', 'thumb_width' => '116', 'thumb_height' => '125', 'image_url' => 'http://i.imgur.com/w6pQEvY.jpg', 'imgur_hash' => 'something', 'subject' => null, 'name' => 'Anonymous', 'tripcode' => null, 'capcode' => null, 'post_timestamp' => DB::raw('FROM_UNIXTIME(1429902005)'), 'body' => 'What is your movie editing software of choice? Pic related for me, but the things you can do it with are pretty limited. Is there a good (free) alternative for simple video editing?']); Post::create(['chan_id' => 222222225, 'thread_id' => 2, 'subject' => null, 'name' => 'Anonymous', 'tripcode' => null, 'capcode' => null, 'post_timestamp' => DB::raw('FROM_UNIXTIME(1429902005)'), 'body' => 'What is your movie editing software of choice? Pic related for me, but the things you can do it with are pretty limited. Is there a good (free) alternative for simple video editing?']); ################## Thread::create(['id' => 3, 'thread_id' => 333333333, 'board' => 'g', 'updated_num' => 3, 'views' => '123', 'notice' => 'Admin note: This thread is garbage.', 'secret' => 'a719c9a1', 'takedown_reason' => null, 'tweeted_at' => null]); Post::create(['chan_id' => 333333333, 'thread_id' => 3, 'original_image_name' => 'Imgur.jpg', 'image_size' => 128000, 'image_width' => '535', 'image_height' => '535', 'thumb_width' => '250', 'thumb_height' => '250', 'image_url' => 'http://i.imgur.com/UmmyTUG.png', 'imgur_hash' => 'something', 'subject' => null, 'name' => 'Anonymous', 'tripcode' => null, 'capcode' => null, 'post_timestamp' => DB::raw('FROM_UNIXTIME(1429902005)'), 'body' => 'What is your movie editing software of choice? Pic related for me, but the things you can do it with are pretty limited. Is there a good (free) alternative for simple video editing?']); Post::create(['chan_id' => 333333334, 'thread_id' => 3, 'subject' => null, 'name' => 'Anonymous', 'tripcode' => null, 'capcode' => null, 'post_timestamp' => DB::raw('FROM_UNIXTIME(1429902005)'), 'body' => 'What is your movie editing software of choice? Pic related for me, but the things you can do it with are pretty limited. Is there a good (free) alternative for simple video editing?']); Post::create(['chan_id' => 333333335, 'thread_id' => 3, 'original_image_name' => 'Imgur 2.jpg', 'image_size' => 34000, 'image_width' => '500', 'image_height' => '466', 'thumb_width' => '116', 'thumb_height' => '125', 'image_url' => 'http://i.imgur.com/w6pQEvY.jpg', 'imgur_hash' => 'something', 'subject' => null, 'name' => 'Anonymous', 'tripcode' => null, 'capcode' => null, 'post_timestamp' => DB::raw('FROM_UNIXTIME(1429902005)'), 'body' => 'What is your movie editing software of choice? Pic related for me, but the things you can do it with are pretty limited. Is there a good (free) alternative for simple video editing?']); Post::create(['chan_id' => 333333336, 'thread_id' => 3, 'subject' => null, 'name' => 'Anonymous', 'tripcode' => null, 'capcode' => null, 'post_timestamp' => DB::raw('FROM_UNIXTIME(1429902005)'), 'body' => 'What is your movie editing software of choice? Pic related for me, but the things you can do it with are pretty limited. Is there a good (free) alternative for simple video editing?']); ################## Thread::create(['id' => 4, 'thread_id' => 444444444, 'board' => 'q', 'updated_num' => 10, 'views' => '1250', 'notice' => null, 'secret' => 'a719c9a1', 'takedown_reason' => null, 'tweeted_at' => null, 'deleted_at' => DB::raw('NOW()')]); Post::create(['chan_id' => 444444444, 'thread_id' => 4, 'original_image_name' => 'Imgur.jpg', 'image_size' => 128000, 'image_width' => '535', 'image_height' => '535', 'thumb_width' => '250', 'thumb_height' => '250', 'image_url' => 'http://i.imgur.com/UmmyTUG.png', 'imgur_hash' => 'something', 'subject' => null, 'name' => 'Anonymous', 'tripcode' => null, 'capcode' => null, 'post_timestamp' => DB::raw('FROM_UNIXTIME(1429902005)'), 'body' => 'What is your movie editing software of choice? Pic related for me, but the things you can do it with are pretty limited. Is there a good (free) alternative for simple video editing?']); Post::create(['chan_id' => 444444445, 'thread_id' => 4, 'subject' => null, 'name' => 'Anonymous', 'tripcode' => null, 'capcode' => null, 'post_timestamp' => DB::raw('FROM_UNIXTIME(1429902005)'), 'body' => 'What is your movie editing software of choice? Pic related for me, but the things you can do it with are pretty limited. Is there a good (free) alternative for simple video editing?']); Post::create(['chan_id' => 444444446, 'thread_id' => 4, 'original_image_name' => 'Imgur 2.jpg', 'image_size' => 34000, 'image_width' => '500', 'image_height' => '466', 'thumb_width' => '116', 'thumb_height' => '125', 'image_url' => 'http://i.imgur.com/w6pQEvY.jpg', 'imgur_hash' => 'something', 'subject' => null, 'name' => 'Anonymous', 'tripcode' => null, 'capcode' => null, 'post_timestamp' => DB::raw('FROM_UNIXTIME(1429902005)'), 'body' => 'What is your movie editing software of choice? Pic related for me, but the things you can do it with are pretty limited. Is there a good (free) alternative for simple video editing?']); Post::create(['chan_id' => 444444447, 'thread_id' => 4, 'subject' => null, 'name' => 'Anonymous', 'tripcode' => null, 'capcode' => null, 'post_timestamp' => DB::raw('FROM_UNIXTIME(1429902005)'), 'body' => 'What is your movie editing software of choice? Pic related for me, but the things you can do it with are pretty limited. Is there a good (free) alternative for simple video editing?']); }
public function storeMessage($user, $input) { $thread = Thread::create(['subject' => $input['subject']]); Message::create(['thread_id' => $thread->id, 'user_id' => Auth::user()->id, 'body' => $input['message']]); Participant::create(['thread_id' => $thread->id, 'user_id' => Auth::user()->id, 'last_read' => new Carbon()]); Participant::create(['thread_id' => $thread->id, 'user_id' => $user->id, 'last_read' => new Carbon()]); $this->sentMessageNotification($user); }
public function run() { Model::unguard(); // MUST fail is have nothing $aConvID = Conversation::firstOrFail()->id; $userID = User::firstOrFail()->id; Thread::create(['Content' => 'A Thread comment seeded', 'user_id' => $userID, 'conversation_id' => $aConvID]); }
/** * Run the database seeds. * * @return void */ public function run() { Model::unguard(); $users = \App\User::lists('id')->all(); $forums = \App\Forum::lists('id')->all(); $faker = \Faker\Factory::create(); foreach (range(1, 200) as $index) { $user_id = $faker->randomElement($users); $thread = \App\Thread::create(['user_id' => $user_id, 'forum_id' => $faker->randomElement($forums), 'title' => $faker->sentence(6), 'slug' => $faker->slug]); $text = $faker->paragraphs(mt_rand(1, 5)); $paragraphs = ''; foreach ($text as $index => $t) { $paragraphs .= $t; if ($index != count($text) - 1) { $paragraphs .= "\n\n"; } } \App\Post::create(['user_id' => $user_id, 'thread_id' => $thread->id, 'thread_first' => $thread->id, 'post' => $paragraphs]); } Model::reguard(); }
/** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function store(CreateThreadRequest $request) { try { App\Forum::findOrFail($request->forum_id); } catch (ModelNotFoundException $e) { \Session::flash('flash_message', 'Forum does not exist'); return redirect('/'); } // replace non letter or digits with '-' $text = preg_replace('~[^\\pL\\d]+~u', '-', $request->title); // trim $text = trim($text, '-'); // transliterate $text = iconv('utf-8', 'us-ascii//TRANSLIT', $text); // lowercase $text = strtolower($text); // remove unwanted characters $text = preg_replace('~[^-\\w]+~', '', $text); $user_id = \Auth::user()->id; $thread = App\Thread::create(['forum_id' => $request->forum_id, 'user_id' => $user_id, 'title' => $request->title, 'slug' => $text]); App\Post::create(['user_id' => \Auth::user()->id, 'thread_id' => $thread->id, 'post' => $request->post]); return redirect('thread/' . $thread->id); }
public function run() { DB::table('threads')->delete(); Thread::create(array('thread' => '仙台出身の俺氏におすすめの酒場を教えるスレ', 'user' => 'morimori')); }