コード例 #1
0
 /**
  * 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();
     });
 }
コード例 #2
0
 public function role_id()
 {
     return UserRole::getKey($this->entity->role_id);
 }