39 lines
705 B
PHP
39 lines
705 B
PHP
<?php
|
|
|
|
namespace App\Console\Commands;
|
|
|
|
use App\Models\User;
|
|
use Illuminate\Console\Command;
|
|
|
|
class MakeUser extends Command
|
|
{
|
|
/**
|
|
* The name and signature of the console command.
|
|
*
|
|
* @var string
|
|
*/
|
|
protected $signature = 'make:user {name}';
|
|
|
|
/**
|
|
* The console command description.
|
|
*
|
|
* @var string
|
|
*/
|
|
protected $description = 'Create a new user';
|
|
|
|
|
|
|
|
/**
|
|
* Execute the console command.
|
|
*/
|
|
public function handle()
|
|
{
|
|
$name = (string) $this->argument('name');
|
|
$user = new User();
|
|
$user->name = $name;
|
|
$user->save();
|
|
$id = $user->id;
|
|
$this->info("Created user with id $id");
|
|
}
|
|
}
|