Archived
1
0
Fork 0

initial commit

This commit is contained in:
Henrik Hautakoski 2021-06-28 17:33:29 +01:00
commit 1e1aa7d461
215 changed files with 35140 additions and 0 deletions

View file

@ -0,0 +1,51 @@
<?php
namespace App\Console\Commands;
use App\Models\User;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Hash;
class CreateUser extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'user:create {username} {password} {--admin}';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Create a user';
/**
* Execute the console command.
*
* @return int
*/
public function handle()
{
$username = $this->argument('username');
$password = $this->argument('password');
$role = 'user';
if ($this->option('admin')) {
$role = 'admin';
}
User::create([
'username' => $username,
'password' => Hash::make($password),
'role' => $role
]);
$this->info('Created');
return 0;
}
}