mirror of
https://github.com/vitodeploy/vito.git
synced 2025-07-02 14:36:17 +00:00
fixes
This commit is contained in:
@ -1,28 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class CreateDatabaseCommand extends Command
|
||||
{
|
||||
protected $signature = 'database:create';
|
||||
|
||||
protected $description = 'Create the database if it does not exist.';
|
||||
|
||||
public function handle(): void
|
||||
{
|
||||
$schemaName = config("database.connections.mysql.database");
|
||||
|
||||
config(["database.connections.mysql.database" => null]);
|
||||
|
||||
$query = "CREATE DATABASE IF NOT EXISTS $schemaName";
|
||||
|
||||
DB::statement($query);
|
||||
|
||||
config(["database.connections.mysql.database" => $schemaName]);
|
||||
|
||||
$this->info(sprintf("Database `%s` created successfully.", $schemaName));
|
||||
}
|
||||
}
|
@ -8,19 +8,18 @@
|
||||
|
||||
class CreateUserCommand extends Command
|
||||
{
|
||||
protected $signature = 'user:create {name} {email}';
|
||||
protected $signature = 'user:create {name} {email} {password}';
|
||||
|
||||
protected $description = 'Create a new user';
|
||||
|
||||
public function handle(): void
|
||||
{
|
||||
$password = Str::random(20);
|
||||
User::create([
|
||||
'name' => $this->argument('name'),
|
||||
'email' => $this->argument('email'),
|
||||
'password' => bcrypt($password),
|
||||
'password' => bcrypt($this->argument('password')),
|
||||
]);
|
||||
|
||||
$this->info("User created with password: {$password}");
|
||||
$this->info("User created with password");
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user