<?php

namespace App\Console\Commands;

use Clarkeash\Doorman\Facades\Doorman;
use Illuminate\Console\Command;

class GenerateCode extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'code:generate {email}';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Generate an Access Code for email';

    /**
     * Create a new command instance.
     *
     * @return void
     */
    public function __construct()
    {
        parent::__construct();
    }

    /**
     * Execute the console command.
     *
     * @return mixed
     */
    public function handle()
    {
        echo Doorman::generate()->for($this->argument('email'))->expiresIn(14)->make();
    }
}
