ldc-gen-game-web/app/Console/Commands/CreateAdmin.php
2020-11-05 12:59:21 +01:00

62 lines
1.3 KiB
PHP

<?php
namespace App\Console\Commands;
use App\User;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Hash;
class CreateAdmin extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'create:admin';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Command description';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return int
*/
public function handle()
{
$pwd = $this->secret('What is the password?');
$user = new User();
$user->civility = 1;
$user->firstname = "Informatique";
$user->lastname = "Internet";
$user->birth_date = now();
$user->email = "informatique.internet@ldc.fr";
$user->password = Hash::make($pwd);
$user->address = "-";
$user->town = "Le Mans";
$user->postal_code = "72000";
$user->country = "France";
$user->email_verify_token = "-";
$user->email_verified = 1;
$user->role = 1;
$user->save();
$this->info('User created.');
}
}