Exemplo n.º 1
0
 /**
  * Validate and save the user data to create a new user.
  *
  * @param Request $request
  * @return mixed
  */
 public function doRegister(CreateUserRequest $request)
 {
     //create new user and save into users table
     $user_arr = array('name' => $request->input('name'), 'email' => $request->input('email'), 'password' => Hash::make($request->input('password')));
     $user = User::create($user_arr);
     if (!$user) {
         //if registration fails
         Session::flash('error', 'Registration failed..please try again later');
         return Redirect::to('users/register');
     } else {
         UserRoles::create(array('uid' => $user->id, 'rid' => 2));
     }
     // successful registration
     Session::flash('success', 'You have registered successfully');
     return Redirect::to('users/login');
 }
Exemplo n.º 2
0
 /**
  * save new user
  * @param CreateUserRequest $request
  * @return mixed
  */
 public function saveNewUser(CreateUserRequest $request)
 {
     access_check('manage_users');
     //create new user and save into users table
     $user_arr = array('name' => $request->input('name'), 'email' => $request->input('email'), 'password' => Hash::make($request->input('password')));
     $user = User::create($user_arr);
     if (!$user) {
         //if registration fails
         Session::flash('error', 'User not created..please try again later');
         return Redirect::to('admin/addUser');
     } else {
         UserRoles::create(array('uid' => $user->id, 'rid' => 2));
     }
     // successful registration
     Session::flash('success', 'Successfully user created');
     return Redirect::to('admin/userListing');
 }
Exemplo n.º 3
0
 public function run()
 {
     $user = \Focalworks\Users\User::create(['name' => 'Admin', 'email' => '*****@*****.**', 'password' => Hash::make('pass')]);
     \Focalworks\Users\UserRoles::create(['uid' => $user->id, 'rid' => 2]);
     \Focalworks\Users\UserRoles::create(['uid' => $user->id, 'rid' => 1]);
 }