Exemplo n.º 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();
 }
 /**
  * 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();
 }
Exemplo n.º 3
0
 /**
  * Handle a registration request for the application.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  bool  $withSubscription
  * @return \Illuminate\Http\Response
  */
 protected function handleRegistration(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]);
         event(new TeamCreated($team));
     }
     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()]);
 }
Exemplo n.º 4
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();
 }
Exemplo n.º 5
0
 /**
  * Get the current user of the application.
  *
  * @return \Illuminate\Http\Response
  */
 public function getCurrentUser()
 {
     return $this->users->getCurrentUser();
 }
Exemplo n.º 6
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  \App\Http\Requests\API\v1\UserRequest $request
  * @param  \App\Contracts\Repositories\UserRepository $userRepo
  * @return \Illuminate\Http\Response
  */
 public function store(UserRequest $request, UserRepository $userRepo)
 {
     $userRepo->create($request);
     return $this->response->created();
 }
Exemplo n.º 7
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int $id
  * @return Response
  */
 public function destroy($id)
 {
     $this->users->destroy($id);
     return redirect()->route('admin.auth.user.index')->withSuccess('Post deleted.');
 }