Skip to main content

Black Friday 2025! Only until December 1st: coupon FRIDAY25 for 40% off Yearly/Lifetime membership!

Read more here

PHPJunior/mtube

144 stars
1 code files
View PHPJunior/mtube on GitHub

app/Console/Commands/AdminCommand.php

Open in GitHub
use App\Models\Auth\Admin;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Hash;
 
class AdminCommand extends Command
{
protected $signature = 'create:admin';
 
protected $description = 'Create a new admin';
 
public function __construct()
{
parent::__construct();
}
 
public function handle()
{
$name = $this->ask('Name');
$email = $this->ask('Email Address');
$password = $this->secret('Password');
 
Admin::create([
'email' => $email,
'name' => $name,
'password' => Hash::make($password),
]);
 
$this->info('User created successfully.');
}
}

We'd Love Your Feedback

Tell us what you like or what we can improve

Feel free to share anything you like or dislike about this page or the platform in general.