Files
airline-agency/app/Console/Commands/AdminGeneratorCommand.php

44 lines
960 B
PHP

<?php
namespace App\Console\Commands;
use App\Enums\Admin\AdminRole;
use App\Enums\Admin\AdminStatus;
use App\Models\Admin;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Hash;
class AdminGeneratorCommand extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'app:admin-generator';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Command description';
/**
* Execute the console command.
*/
public function handle()
{
Admin::create([
'first_name' => 'Admin',
'last_name' => 'admin',
'username' => 'admin1234',
'password' => Hash::make('123456789'),
'status' => AdminStatus::ACTIVE,
'role' => AdminRole::SUPERADMIN
]);
$this->info('Admin created successfully.');
}
}