Lae/app/Console/Commands/Admin/Delete.php

44 lines
847 B
PHP
Raw Normal View History

2022-11-17 11:52:23 +00:00
<?php
namespace App\Console\Commands\Admin;
use App\Models\Admin;
use Illuminate\Console\Command;
2023-01-10 13:42:27 +00:00
use Symfony\Component\Console\Command\Command as CommandAlias;
2022-11-17 11:52:23 +00:00
class Delete extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'admin:delete';
/**
* The console command description.
*
* @var string
*/
protected $description = '删除一个管理员';
/**
* Execute the console command.
*
* @return int
*/
2023-01-10 13:42:27 +00:00
public function handle(): int
2022-11-17 11:52:23 +00:00
{
// 获取管理员ID
$id = $this->ask('请输入管理员ID');
// 删除管理员
Admin::destroy($id);
// 输出信息
$this->info('管理员删除成功。');
2023-01-30 16:14:07 +00:00
2023-01-10 13:42:27 +00:00
return CommandAlias::SUCCESS;
2022-11-17 11:52:23 +00:00
}
}