for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace Garbuzivan\Laraveltokens\Commands;
use Garbuzivan\Laraveltokens\TokenManager;
use Illuminate\Console\Command;
use Illuminate\Support\Composer;
class DeactivationGlobalByIDCommand extends Command
{
/**
* The console command name.
*
* @var string
*/
protected $name = 'tokens:global-deactivation-by-id {token_id}';
* The console command description.
protected $description = 'Деактивировать глобальный токен по ID токена ' .
' (tokens:global-deactivation-by-id {token_id})';
* The console command signature.
protected $signature = 'tokens:global-deactivation-by-id {token_id}';
* @var Composer
public Composer $composer;
* @var TokenManager
public TokenManager $TokenManager;
* Create a new command instance.
public function __construct(TokenManager $TokenManager)
parent::__construct();
$this->TokenManager = $TokenManager;
}
* Execute the command.
* @return mixed
public function handle()
$arguments = $this->arguments();
$token_id = $arguments['token_id'] ? intval($arguments['token_id']) : null;
if (is_null($token_id) || $token_id < 1) {
$this->line('ID токена не введен.');
return 1;
$this->TokenManager->deactivationGlobalTokenById($token_id);
$this->line('Токен деактивирован.');