Пример #1
0
 public function getDeactivate($sid)
 {
     $user = User::find($sid);
     if ($user == null) {
         $errors = new \Illuminate\Support\MessageBag();
         $errors->add('editError', "The user cannot be found because it does not exist or may have been deleted.");
         return redirect('/admin/users')->withErrors($errors);
     }
     // Deactivate the user
     $user->activated = false;
     $user->save();
     return redirect()->back();
 }
Пример #2
0
 public function getDeactivate($sid)
 {
     $this_user = Auth::user();
     if ($this_user->id == $sid) {
         $errors = new MessageBag();
         $errors->add('editError', Lang::get('redminportal::messages.user_error_deactivate_own_account'));
         return redirect('/admin/users')->withErrors($errors);
     }
     $user = User::find($sid);
     if ($user == null) {
         $errors = new MessageBag();
         $errors->add('editError', Lang::get('redminportal::messages.user_error_user_not_found'));
         return redirect('/admin/users')->withErrors($errors);
     }
     // Deactivate the user
     $user->activated = false;
     $user->save();
     return redirect()->back();
 }