/**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     \DB::table('roles')->truncate();
     $roles = [['name' => 'login', 'description' => 'Login privileges, granted after account confirmation.'], ['name' => 'administrator', 'description' => 'Administrative user, has access to everything.'], ['name' => 'developer', 'description' => '']];
     foreach ($roles as $data) {
         UserRole::create($data);
     }
 }
 /**
  * Create a new user instance after a valid registration.
  *
  * @param  array $data
  * @return User
  */
 public function create(array $data)
 {
     $role = UserRole::create(array_only($data, ['name', 'description']));
     if (isset($data['permissions'])) {
         $permissions = (array) $data['permissions'];
         $role->attachPermissions($permissions);
     }
     return $role;
 }