解除封禁用户
This commit is contained in:
parent
6c82b8afb5
commit
20610b1c37
59
app/Console/Commands/UnbanUser.php
Normal file
59
app/Console/Commands/UnbanUser.php
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Console\Commands;
|
||||||
|
|
||||||
|
use App\Models\Host;
|
||||||
|
use App\Models\User;
|
||||||
|
use App\Models\AccessToken;
|
||||||
|
use Illuminate\Console\Command;
|
||||||
|
|
||||||
|
class UnbanUser extends Command
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The name and signature of the console command.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $signature = 'unban {user_id}';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The console command description.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $description = '解除封禁一个用户。';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new command instance.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Execute the console command.
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function handle()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
|
||||||
|
$user_id = $this->argument('user_id');
|
||||||
|
|
||||||
|
$reason = $this->argument('reason');
|
||||||
|
|
||||||
|
$user = User::find($user_id);
|
||||||
|
|
||||||
|
$this->info('解除封禁: ' . $user->name);
|
||||||
|
|
||||||
|
$user->banned_at = null;
|
||||||
|
$user->banned_reason = $reason;
|
||||||
|
$user->save();
|
||||||
|
|
||||||
|
$this->info('用户已解除封禁。');
|
||||||
|
}
|
||||||
|
}
|
@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
use App\Console\Commands\BanUser;
|
use App\Console\Commands\BanUser;
|
||||||
use App\Console\Commands\SuspendUserAllHosts;
|
use App\Console\Commands\SuspendUserAllHosts;
|
||||||
|
use App\Console\Commands\UnbanUser;
|
||||||
use App\Jobs\HostCost;
|
use App\Jobs\HostCost;
|
||||||
use App\Jobs\ClearTasks;
|
use App\Jobs\ClearTasks;
|
||||||
use App\Jobs\DeleteHost;
|
use App\Jobs\DeleteHost;
|
||||||
@ -21,6 +22,7 @@ class Kernel extends ConsoleKernel
|
|||||||
protected $commands = [
|
protected $commands = [
|
||||||
//
|
//
|
||||||
BanUser::class,
|
BanUser::class,
|
||||||
|
UnbanUser::class,
|
||||||
SuspendUserAllHosts::class
|
SuspendUserAllHosts::class
|
||||||
];
|
];
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user