/**
  * @param CreateUserRequest $request
  *
  * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
  */
 public function store(CreateUserRequest $request)
 {
     $user = $this->user->create($request->all());
     Flash::success(trans('admin/users/general.status.created'));
     // 'User successfully created');
     return redirect('/admin/users');
 }
 /**
  * Store a newly created User in storage.
  *
  * @param CreateUserRequest $request
  *
  * @return Response
  */
 public function store(CreateUserRequest $request)
 {
     $input = $request->all();
     $user = $this->userRepository->create($input);
     Flash::success('User saved successfully.');
     return redirect(route('users.index'));
 }
Example #3
0
 /**
  * Register the user.
  *
  * @param RegisterRequest $request
  * @return $this|\Illuminate\Http\RedirectResponse
  */
 public function register(RegisterRequest $request)
 {
     $success = $this->repository->create($request->all());
     if (!$success) {
         return redirect()->back()->withErrors(['register_failed' => Lang::get('auth.register_failed')]);
     }
     return redirect()->route('auth.login')->with(['notice' => Lang::get('auth.register_success')]);
 }
 /**
  * Create user registration.
  *
  * @param Request $request
  * @param AppMailer $mailer
  * @return \Illuminate\Http\RedirectResponse
  */
 public function postRegister(Request $request, AppMailer $mailer)
 {
     $this->validate($request, $this->validateRegistrationForm());
     $user = $this->users->create($request->all());
     if (Auth::attempt($this->getCredentials($request))) {
         $mailer->sendEmailVerificationTo($user);
     }
     return redirect('/');
 }
 /**
  * Store a newly created User in storage.
  * POST /users
  *
  * @param Request $request
  *
  * @return Response
  */
 public function store(Request $request)
 {
     if (sizeof(User::$rules) > 0) {
         $this->validateRequestOrFail($request, User::$rules);
     }
     $input = $request->all();
     $users = $this->userRepository->create($input);
     return $this->sendResponse($users->toArray(), "User saved successfully");
 }
 /**
  * @param CreateUserRequest $request
  *
  * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
  */
 public function store(CreateUserRequest $request)
 {
     $user = $this->user->create($request->all());
     if ($request->get('role')) {
         $user->roles()->sync($request->get('role'));
     } else {
         $user->roles()->sync([]);
     }
     Flash::success('User successfully created');
     return redirect('/users');
 }
Example #7
0
 /**
  * Store a newly created User in storage.
  *
  * @param CreateUserRequest $request
  *
  * @return Response
  */
 public function store(CreateUserRequest $request)
 {
     $this->authorize('users.manage');
     $input = $request->all();
     if (!empty($input['password'])) {
         $input['password'] = bcrypt($input['password']);
     } else {
         unset($input['password']);
     }
     $user = $this->userRepository->create($input);
     $user->roles()->sync([$request->get('role')]);
     Flash::success('User saved successfully.');
     return redirect(route('users.index'));
 }
 /**
  * @param CreateUserRequest $request
  *
  * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
  */
 public function store(CreateUserRequest $request)
 {
     $attributes = $request->all();
     Audit::log(Auth::user()->id, trans('admin/users/general.audit-log.category'), trans('admin/users/general.audit-log.msg-store', ['username' => $attributes['username']]));
     if (array_key_exists('selected_roles', $attributes)) {
         $attributes['role'] = explode(",", $attributes['selected_roles']);
     }
     if ($attributes['role'][0] == '') {
         $attributes['role'][0] = "2";
     }
     // Create basic user.
     $user = $this->user->create($attributes);
     // Run the update method to set enabled status and roles membership.
     $user->update($attributes);
     //       TODO: Create front end system to manage users and clusters
     //       TODO: In the meantime, give all users access to every cluster.
     $clusters = Cluster::all();
     foreach ($clusters as $cluster) {
         $user->clusters()->attach($cluster);
     }
     /*
      * Assign the new user's active cluster
      */
     $user->activateCluster($attributes['activeCluster']);
     /*
      * Assign the department
      */
     $department = Department::find($attributes['department']);
     $department->users()->save($user);
     $user->save();
     alert()->success(trans('admin/users/general.status.created'));
     // 'User successfully created');
     return redirect('/admin/users');
 }
 /**
  * @param CreateUserRequest $request
  *
  * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
  */
 public function store(CreateUserRequest $request)
 {
     $attributes = $request->all();
     if (array_key_exists('selected_roles', $attributes)) {
         $attributes['role'] = explode(",", $attributes['selected_roles']);
     }
     // Create basic user.
     $user = $this->user->create($attributes);
     // Run the update method to set enabled status and roles membership.
     $user->update($attributes);
     Flash::success(trans('admin/users/general.status.created'));
     // 'User successfully created');
     return redirect('/admin/users');
 }
 /**
  * @param CreateUserRequest $request
  *
  * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
  */
 public function store(CreateUserRequest $request)
 {
     $this->validate($request, array('username' => 'required|unique:users', 'email' => 'required|unique:users', 'first_name' => 'required', 'last_name' => 'required'));
     $attributes = $request->all();
     Audit::log(Auth::user()->id, trans('admin/users/general.audit-log.category'), trans('admin/users/general.audit-log.msg-store', ['username' => $attributes['username']]));
     if (array_key_exists('selected_roles', $attributes) && !empty($attributes['selected_roles'])) {
         $attributes['role'] = explode(",", $attributes['selected_roles']);
     } else {
         $attributes['role'] = [];
     }
     // Create basic user.
     $user = $this->user->create($attributes);
     // Run the update method to set enabled status and roles membership.
     $user->update($attributes);
     Flash::success(trans('admin/users/general.status.created'));
     // 'User successfully created');
     return redirect('/admin/users');
 }
Example #11
0
 /**
  * Store a newly created resource in storage.
  *
  * @param UserRequest $request
  *
  * @return \Illuminate\Http\RedirectResponse
  */
 public function store(UserRequest $request)
 {
     $this->users->create($request->all());
     return redirect()->route('admin.users.index');
 }
 /**
  * Show the form for creating a new resource.
  *
  * @return Response
  */
 public function create()
 {
     return view('back.users.create', $this->user_gestion->create());
 }
Example #13
0
 /**
  * Create a new user instance after a valid registration.
  *
  * @param  array $data
  * @return User
  */
 protected function createNewUser(array $data)
 {
     $user = $this->repo->create($data);
     return $user;
 }
Example #14
-1
 /**
  * Add the User to the Database and Authenticate
  * @param Request $request 
  * @param User    $repo    
  */
 public function addUser(CrateUserRequest $request, User $repo)
 {
     $role = \App\Role::where('name', 'user')->get()->first();
     $user = $repo->create($request->all());
     $user->attachRole($role);
     Auth::attempt(['email' => $user->email, 'password' => $user->password]);
     return redirect()->route()->intended('registration');
 }