Esempio n. 1
0
 private function _create_default_role()
 {
     \Cli::beep(1);
     // get attention
     $create_role = \Cli::prompt("\nCreate a default user role?", array('y', 'n'));
     if ($create_role === 'y') {
         $role_name = \Cli::prompt("\nPlease enter the role name");
         try {
             $new = \Model_Role::forge(array('name' => $role_name, 'description' => 'Default login role.'))->save();
             \Config::set('warden.default_role', $role_name);
             \Cli::write(\Cli::color("\nRole id  : {$new}", 'blue'));
             \Cli::write(\Cli::color("Role name: {$role_name}", 'blue'));
         } catch (\Exception $e) {
             \Cli::error("\n:( Failed to create default role because: {$e->getMessage()}");
         }
     }
 }