Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
n/a
0 / 0
n/a
0 / 0
CRAP
n/a
0 / 0
UserCreate
n/a
0 / 0
n/a
0 / 0
1
n/a
0 / 0
 handle
n/a
0 / 0
n/a
0 / 0
1
1<?php
2
3namespace App\Console\Commands;
4
5use App\Models\User;
6use Illuminate\Console\Command;
7use Illuminate\Support\Facades\Hash;
8
9/**
10 * @codeCoverageIgnore
11 */
12class UserCreate extends Command
13{
14    /**
15     * The name and signature of the console command.
16     *
17     * @var string
18     */
19    protected $signature = 'user:create';
20
21    /**
22     * The console command description.
23     *
24     * @var string
25     */
26    protected $description = 'Command description';
27
28    /**
29     * Execute the console command.
30     *
31     * @return integer
32     */
33    public function handle()
34    {
35        $firstname = $this->ask('What is the firstname?');
36        $lastname  = $this->ask('What is the lastname?');
37        $email     = $this->ask('What is the email?');
38        $pwd       = $this->secret('What is the password?');
39
40        $user            = new User();
41        $user->firstname = $firstname;
42        $user->lastname  = $lastname;
43        $user->email     = $email;
44        $user->password  = Hash::make($pwd);
45        $user->save();
46
47        $this->info('User created.');
48        return 0;
49    }
50}