diff --git a/app/Console/Commands/UserSuspend.php b/app/Console/Commands/UserSuspend.php new file mode 100644 index 000000000..17d44d2d5 --- /dev/null +++ b/app/Console/Commands/UserSuspend.php @@ -0,0 +1,56 @@ +argument('id'); + $user = User::whereUsername($id)->orWhere('id', $id)->first(); + if(!$user) { + $this->error('Could not find any user with that username or id.'); + exit; + } + $this->info('Found user, username: ' . $user->username); + if($this->confirm('Are you sure you want to suspend this user?')) { + $profile = $user->profile; + $user->status = $profile->status = 'suspended'; + $user->save(); + $profile->save(); + $this->info('User account has been suspended.'); + } + } +} diff --git a/app/Console/Commands/UserUnsuspend.php b/app/Console/Commands/UserUnsuspend.php new file mode 100644 index 000000000..afb6dee6a --- /dev/null +++ b/app/Console/Commands/UserUnsuspend.php @@ -0,0 +1,56 @@ +argument('id'); + $user = User::whereUsername($id)->orWhere('id', $id)->first(); + if(!$user) { + $this->error('Could not find any user with that username or id.'); + exit; + } + $this->info('Found user, username: ' . $user->username); + if($this->confirm('Are you sure you want to unsuspend this user?')) { + $profile = $user->profile; + $user->status = $profile->status = null; + $user->save(); + $profile->save(); + $this->info('User account has been unsuspended.'); + } + } +}