Example #1
0
 /**
  * Update the user's profile information.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function updateUserProfile(Request $request)
 {
     $this->validateUserProfile($request);
     $originalEmail = Auth::user()->email;
     if (Spark::$updateProfilesWith) {
         $this->callCustomUpdater(Spark::$updateProfilesWith, $request);
     } else {
         Auth::user()->fill($request->all())->save();
     }
     if (Auth::user()->stripe_id && $originalEmail !== Auth::user()->email) {
         $this->updateStripeEmailAddress();
     }
     event(new ProfileUpdated(Auth::user()));
     return $this->users->getCurrentUser();
 }
Example #2
0
 /**
  * Resume the user's subscription.
  *
  * @return \Illuminate\Http\Response
  */
 public function resumeSubscription()
 {
     $user = Auth::user();
     $user->subscription('main')->resume();
     event(new SubscriptionResumed(Auth::user()));
     return $this->users->getCurrentUser();
 }
Example #3
0
 /**
  * Resume the user's subscription.
  *
  * @return \Illuminate\Http\Response
  */
 public function resumeSubscription()
 {
     $user = Auth::user();
     $user->subscription($user->stripe_plan)->skipTrial()->resume();
     event(new SubscriptionResumed(Auth::user()));
     return $this->users->getCurrentUser();
 }
Example #4
0
 /**
  * Handle a registration request for the application.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  bool  $withSubscription
  * @return \Illuminate\Http\Response
  */
 protected function register(Request $request, $withSubscription = false)
 {
     $this->validateRegistration($request, $withSubscription);
     $user = $this->users->createUserFromRegistrationRequest($request, $withSubscription);
     if ($request->team_name) {
         $team = $this->teams->create($user, ['name' => $request->team_name]);
     }
     if ($request->invitation) {
         $this->teams->attachUserToTeamByInvitation($request->invitation, $user);
     }
     event(new Registered($user));
     if ($withSubscription) {
         event(new Subscribed($user));
     }
     Auth::login($user);
     return response()->json(['path' => $this->redirectPath()]);
 }
Example #5
0
 /**
  * Disable two-factor authentication for the user.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function disableTwoFactorAuth(Request $request)
 {
     Spark::twoFactorProvider()->delete(Auth::user());
     Auth::user()->save();
     return $this->users->getCurrentUser();
 }
Example #6
0
 /**
  * Get the current user of the application.
  *
  * @return \Illuminate\Http\Response
  */
 public function getCurrentUser()
 {
     return $this->users->getCurrentUser();
 }