irfaardy /
lockout-account
| 1 | <?php |
||
| 2 | |||
| 3 | namespace Irfa\Lockout\Console\Commands; |
||
| 4 | |||
| 5 | use Illuminate\Console\Command; |
||
| 6 | use Irfa\Lockout\Func\Core; |
||
| 7 | use Symfony\Component\Console\Helper\Table; |
||
| 8 | |||
| 9 | class AttempsCommands extends Command |
||
| 10 | { |
||
| 11 | /** |
||
| 12 | * The name and signature of the console command. |
||
| 13 | * |
||
| 14 | * @var string |
||
| 15 | */ |
||
| 16 | protected $signature = 'lockout:check {username}'; |
||
| 17 | |||
| 18 | /** |
||
| 19 | * The console command description. |
||
| 20 | * |
||
| 21 | * @var string |
||
| 22 | */ |
||
| 23 | protected $description = 'Unlock Account'; |
||
| 24 | |||
| 25 | /** |
||
| 26 | * Create a new command instance. |
||
| 27 | * |
||
| 28 | * @return void |
||
| 29 | */ |
||
| 30 | public function __construct() |
||
| 31 | { |
||
| 32 | parent::__construct(); |
||
| 33 | } |
||
| 34 | |||
| 35 | /** |
||
| 36 | * Execute the console command. |
||
| 37 | * |
||
| 38 | * @return mixed |
||
| 39 | */ |
||
| 40 | public function handle(Core $core) |
||
| 41 | { |
||
| 42 | $ret = $core->check_account($this->argument('username')); |
||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
| 43 | $table = new Table($this->output); |
||
| 44 | $read_enc = json_decode( $ret); |
||
| 45 | $time = $read_enc->last_attemps; |
||
| 46 | $attemps = $read_enc->attemps; |
||
| 47 | $ip = $read_enc->ip; |
||
| 48 | $table->setRows([ |
||
| 49 | ['<fg=yellow>Login attemps', $attemps], |
||
| 50 | ['<fg=yellow>Last login attemps',$time], |
||
| 51 | ['<fg=yellow>Last IP Address',empty(end($ip))? "unknown":end($ip)],]); |
||
| 52 | $table->render(); |
||
| 53 | // $this->line('<fg=yellow>Valid input is lock, unlock, and attemps.'); |
||
| 54 | |||
| 55 | } |
||
| 56 | |||
| 57 | } |