feat: add admin generator command and enum role/status to admins table
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
<?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.');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user