Exemplo n.º 1
0
 public function takeAll($achievement_id)
 {
     $achievement = Achievement::find($achievement_id);
     if (!$achievement) {
         abort(404);
     }
     $achieved = AchievementOwnership::all();
     foreach ($achieved as $entry) {
         if ($entry->achievement_id == $achievement_id) {
             $entry->delete();
         }
     }
     Session::flash('flash_message', "Achievement {$achievement->name} taken from everyone");
     return Redirect::back();
 }
Exemplo n.º 2
0
 public function deleteUser(Request $request, $id)
 {
     $user = User::findOrFail($id);
     if ($user->id != Auth::id() && !Auth::user()->can('board')) {
         abort(403);
     }
     if ($user->member) {
         $request->session()->flash('flash_message', 'You cannot delete your account while you are a member.');
         return Redirect::back();
     }
     Address::where('user_id', $user->id)->delete();
     Bank::where('user_id', $user->id)->delete();
     EmailListSubscription::where('user_id', $user->id)->delete();
     AchievementOwnership::where('user_id', $user->id)->delete();
     Alias::where('user_id', $user->id)->delete();
     RfidCard::where('user_id', $user->id)->delete();
     WelcomeMessage::where('user_id', $user->id)->delete();
     if ($user->photo) {
         $user->photo->delete();
     }
     $user->password = null;
     $user->remember_token = null;
     $user->birthdate = null;
     $user->gender = null;
     $user->nationality = null;
     $user->phone = null;
     $user->website = null;
     $user->utwente_username = null;
     $user->tfa_totp_key = null;
     $user->tfa_yubikey_identity = null;
     $user->phone_visible = 0;
     $user->address_visible = 0;
     $user->receive_sms = 0;
     $user->save();
     $user->delete();
     $request->session()->flash('flash_message', 'Your account has been deleted.');
     return Redirect::route('homepage');
 }