Example #1
0
 public function handle()
 {
     $model = User::create(['email' => $this->email, 'password' => Hash::make($this->password), 'group' => $this->group, 'name' => $this->name, 'surname' => $this->surname]);
     $keys = KeyPairGenerator::generate($this->password);
     $key = new RsaKey();
     $key->private = $keys['private'];
     $key->public = $keys['public'];
     $key->user_id = $model->id;
     $key->save();
     event(new UserCreated($model));
     return $model;
 }
Example #2
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Eloquent::unguard();
     if (!User::find(1)) {
         User::create(['email' => 'admin', 'password' => Hash::make('admin'), 'name' => 'Main', 'surname' => 'Admin', 'group' => User::GROUP_ADMIN]);
         Project::create(['name' => 'Project 1', 'description' => 'Default starter project', 'user_id' => 1]);
         $keys = KeyPairGenerator::generate('admin');
         $key = new RsaKey();
         $key->private = $keys['private'];
         $key->public = $keys['public'];
         $key->user_id = 1;
         $key->save();
         echo "DB Seeded...\n";
     } else {
         echo "DB Already Seeded...\n";
     }
 }