Files

67 lines
1.5 KiB
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 = 'Command description';
/**
* Execute the console command.
*/
public function handle()
{
$admin=Admin::create([
'full_name' => 'Admin',
'username' => 'admin',
'password' => Hash::make('12345678'),
'status' => AdminStatus::ENABLE
]);
AdminPermission::create([
'admin_id' => $admin->id,
'flight_create' => true,
'flight_edit' => true,
'flight_delete' => true,
'tour_create' => true,
'tour_edit' => true,
'tour_delete' => true,
'booking_view' => true,
'booking_edit' => true,
'booking_delete' => true,
'user_view' => true,
'user_edit' => true,
'user_delete' => true,
'admin_view' => true,
'admin_create' => true,
'admin_edit' => true,
'admin_delete' => true,
]);
$this->info('Admin created successfully');
}
}