Пример #1
0
 /**
  * Delete the user's profile.
  *
  * @return \Illuminate\Http\Response
  */
 public function deleteProfile()
 {
     $user = Credentials::getUser();
     $this->checkUser($user);
     $email = $user->getLogin();
     Credentials::logout();
     try {
         $user->delete();
     } catch (\Exception $e) {
         return Redirect::to(Config::get('credentials.home', '/'))->with('error', 'There was a problem deleting your account.');
     }
     $mail = ['url' => URL::to(Config::get('credentials.home', '/')), 'email' => $email, 'subject' => Config::get('app.name') . ' - Account Deleted Notification'];
     Mail::queue('credentials::emails.userdeleted', $mail, function ($message) use($mail) {
         $message->to($mail['email'])->subject($mail['subject']);
     });
     return Redirect::to(Config::get('credentials.home', '/'))->with('success', 'Your account has been deleted successfully.');
 }
Пример #2
0
 /**
  * Logout the specified user.
  *
  * @return \Illuminate\Http\Response
  */
 public function getLogout()
 {
     Credentials::logout();
     return Redirect::to(Config::get('credentials.home', '/'));
 }