public function run()
 {
     Profile::create(array('user_id' => 1, 'summary' => 'CEO and Chief Engineer of SpaceX & Tesla Motors. A literal god.', 'twitter_account' => 'ElonMusk', 'favorite_mission' => 1, 'favorite_mission_patch' => 1));
     Profile::create(array('user_id' => 2, 'summary' => 'VP of sales', 'favorite_mission' => 4, 'favorite_mission_patch' => 1));
     Profile::create(array('user_id' => 3, 'summary' => 'Creator of the Merlin Engine', 'twitter_account' => 'TMueller'));
     Profile::create(array('user_id' => 4, 'summary' => 'DFJ', 'twitter_account' => 'DFJ'));
     Profile::create(array('user_id' => 5, 'summary' => 'Barry Matsomouri', 'twitter_account' => 'Barry'));
 }
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     $user = new User();
     $user->username = $this->argument('username');
     $user->email = $this->argument('username') . '@spacexstats.com';
     $user->password = $this->argument('password');
     // Hashed as a mutator on the User model
     $user->key = str_random(32);
     $user->role_id = UserRole::fromString($this->argument('role'));
     if ($this->option('launchctl')) {
         $user->launch_controller_flag = true;
     }
     DB::transaction(function () use($user) {
         $user->save();
         // Associate a profile
         $profile = new Profile();
         $profile->user()->associate($user)->save();
     });
 }
Ejemplo n.º 3
0
 /**
  * Create a new user instance after a valid registration, also send them a welcome email.
  *
  * @param array $data
  * @return User
  */
 protected function create(array $data)
 {
     $user = new User();
     $user->username = $data['username'];
     $user->email = $data['email'];
     $user->password = $data['password'];
     // Hashed as a mutator on the User model
     $user->key = str_random(32);
     $user->role_id = UserRole::Unauthenticated;
     DB::transaction(function () use($user) {
         $user->save();
         // Associate a profile
         $profile = new Profile();
         $profile->user()->associate($user)->save();
     });
     // Add a welcome email to the queue
     $this->mailer->welcome($user);
     return $user;
 }