37 lines
703 B
PHP
37 lines
703 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");
|
|
}
|
|
}
|