44 lines
940 B
PHP
44 lines
940 B
PHP
<?php
|
|
|
|
namespace App\Console\Commands;
|
|
|
|
use App\Enums\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 = 'Create default admin user';
|
|
|
|
/**
|
|
* Execute the console command.
|
|
*/
|
|
public function handle()
|
|
{
|
|
|
|
Admin::create([
|
|
'full_name' => 'مدیر سیستم',
|
|
'username' => 'admin',
|
|
'email' => 'admin@gmail.com',
|
|
'mobile' => '09123456789',
|
|
'password' => Hash::make('123456789'),
|
|
'status' => AdminStatus::ENABLE,
|
|
]);
|
|
|
|
$this->info('Admin created successfully.');
|
|
}
|
|
}
|