Пример #1
0
 public function run()
 {
     $faker = Faker::create();
     $users = User::lists('id');
     $topics = Topic::lists('id');
     foreach (range(1, 500) as $index) {
         Reply::create(['user_id' => $faker->randomElement($users), 'topic_id' => $faker->randomElement($topics), 'body' => $faker->sentence()]);
     }
     foreach (range(1, 60) as $index) {
         Reply::create(['user_id' => 1, 'topic_id' => $faker->randomElement($topics), 'body' => $faker->sentence()]);
     }
 }
Пример #2
0
 public function reply()
 {
     if (Session::has('account') && Session::has('password')) {
         $inputs = Input::all();
         $id = Input::get('id');
         $rule = array('reply' => 'required');
         $validator = Validator::make($inputs, $rule);
         if ($validator->fails()) {
             return Redirect::to('seven')->withErrors($validator);
         }
         Reply::create(array('memo' => nl2br(htmlspecialchars(Input::get('reply'))), 'name' => Session::get('name'), 'photo' => Session::get('photo'), 'id' => $id));
         //存進資料庫裡 &&檢查是否有XSS
         return Redirect::to('seven');
     }
     return Redirect::to('seven');
 }