/** * Create/Signup a new user * * @return Response */ public function store(SignupRequest $signupRequest) { $input = $signupRequest->all(); $user = $this->userRepository->create($input); Event::fire(new UserWasSignedUp($user)); return $this->sendSuccess([], 'Successfully signed up. Please check your email to confirm you account.'); }
/** * Url method POST receive all request and process a new user registration * @param SignupRequest $request * @return \Illuminate\Http\RedirectResponse */ public function postSaveUser(SignupRequest $request) { $user = new User(); $user->fill($request->all()); if (!$user->save()) { new \Exception('No se pudo crear la cuenta'); } Auth::login($user); return redirect()->route('homepage'); }
public function postSignup(SignupRequest $request) { $request['password'] = bcrypt($request['password']); // hash password // $request['waitingPosition'] = Carbon::now(); // set date of registration as waiting position $user = User::create($request->all()); // add role to user $role = Role::where('name', 'User')->first(); $user->role()->associate($role); $user->save(); // if there are no people in front on the waiting list and there is a plantPlot free, send and email and set canStartGardening to now // $plantPlots = PlantPlot::getEmptyPlots(); // $usersThatCanStartGardening = User::getUsersThatCanStartGardening(); // if (count($plantPlots) != 0 && count($plantPlots) > count($usersThatCanStartGardening)) // if there is a plot free and there are no users that canStartGardening for this plot // { // // get user first on waiting list // $firstUserInLine = User::getFirstUserInWaitingList(); // // if ($user->id == $firstUserInLine->id) // { // // user can start gardening from this point and is removed from waiting list // $user->canStartGardening = Carbon::now(); // $user->waitingPosition = null; // $user->save(); // // // send email to user // // // // // } // } // check invitations table to see if this email has outstanding invitations $invitations = Invitation::where('email', '=', $user->email)->get(); foreach ($invitations as $invitation) { // link invitations $user->plants()->attach($invitation->plant_id); // delete record from invitations table $invitation->delete(); } Auth::login($user); // when user can start gardening set message // // // flash message session()->flash('successMessage', 'Hey there, enjoy your stay!'); return redirect()->route('dashboard'); }
/** * Save user * * @return Response */ public function postSignup(\App\Http\Requests\SignupRequest $request) { $this->user->create($request->all()); return redirect()->action('AuthenticationController@getLogin')->with('flash_message', trans('authentication.signup_success')); }