/**
  * 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.');
 }
Esempio n. 2
0
 /**
  * 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 signup(SignupRequest $request)
 {
     $email = $request->input('email');
     if (!$this->checkEmail($email)) {
         return redirect()->back()->withInput()->with('error', "{$email} is not a valid email");
     }
     if ($request->input('salted_id')) {
         $originalEmail = Email::where('salted_id', '=', $request->input('salted_id'))->first();
     }
     $first_name = $request->input('first_name');
     $last_name = $request->input('last_name');
     $phone = $request->input('phone');
     $campaign = Campaign::find($request->input('campaign'));
     $contact = Contact::firstOrCreate(['email' => $email, 'client_id' => $campaign->client->id]);
     if ($first_name) {
         $contact->first_name = $first_name;
     }
     if ($last_name) {
         $contact->last_name = $last_name;
     }
     if ($phone) {
         $contact->phone = $phone;
     }
     $contact->save();
     Action::firstOrCreate(['action' => 'signed up', 'contact_id' => $contact->id, 'campaign_id' => $campaign->id]);
     Signup::firstOrCreate(['contact_id' => $contact->id, 'campaign_id' => $campaign->id]);
     return redirect()->back()->with('message', "Thanks for signing up {$first_name}!");
 }
Esempio n. 4
0
 public function signup(SignupRequest $request)
 {
     $credentials = $request->only('name', 'email', 'password');
     $credentials['password'] = bcrypt($credentials['password']);
     try {
         if (User::where('email', '=', $credentials['email'])->count() < 1) {
             $user = User::create($credentials);
         } else {
             return $this->response->withError('User already exists.', 409);
         }
     } catch (Exception $e) {
         return $this->response->withError('User already exists.', 409);
     }
     $token = JWTAuth::fromUser($user);
     return $this->response->array(['token' => $token, 'user' => $user->toArray()]);
 }
 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');
 }
 public function Signup(SignupRequest $request)
 {
     /*them thanh vien*/
     $firstname = $request->get("firstname");
     $lastname = $request->get("lastname");
     $pass = Hash::make($request->get("password"));
     $email = $request->get("email");
     $gender = $request->get("gender");
     $birthday = $request->get("birthday");
     $default_list_id = 0;
     $customer = customer::create(["email" => $email, "password" => $pass, "first_name" => $firstname, "last_name" => $lastname, "default_list_id" => $default_list_id, "gender" => $gender, "birthday" => $birthday]);
     /*tao danh sach mac dinh*/
     LoveList::create(["customer_id" => $customer->id, "name" => "danh sách mặc định"]);
     $default_list_id = LoveList::select(["id"])->where("customer_id", $customer->id)->first();
     /*cap nhat id danh sach mac dinh cho customer*/
     customer::where("id", $customer->id)->update(["default_list_id" => $default_list_id->id]);
     return redirect()->route("login")->with("result", "Đăng kí thành công");
 }
 /**
  * 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'));
 }