Esempio n. 1
0
 public function run()
 {
     $faker = Faker::create();
     foreach (range(1, 10) as $index) {
         $user = User::create(['username' => $faker->userName, 'password' => \Hash::make('123456'), 'email' => $faker->safeEmail, 'type' => $faker->randomElement(['Leader', 'Integrant', 'Client'])]);
         UsersProfile::create(['user_id' => $user->id, 'fullname' => $faker->name, 'website' => $faker->url, 'about' => $faker->text(200)]);
     }
 }
Esempio n. 2
0
 public function postCreate()
 {
     $validator = Validator::make(Input::all(), User::$rules);
     if ($validator->passes()) {
         $user = new User();
         $user->username = Input::get('username');
         $user->email = Input::get('email');
         $user->type = 'Integrant';
         $user->password = Hash::make(Input::get('password'));
         $user->save();
         $user_id = $user->id;
         $userProfile = new UsersProfile();
         $userProfile->fullname = Input::get('fullname');
         $userProfile->website = Input::get('website');
         $userProfile->about = Input::get('about');
         $userProfile->user_id = $user_id;
         $userProfile->save();
         return Redirect::to('users/login')->with('message', 'Thanks for registering!');
     } else {
         return Redirect::to('users/register')->with('message', 'The following errors occurred')->withErrors($validator)->withInput();
     }
 }