Completed
Pull Request — master (#90)
by
unknown
01:57
created

AppCreate::handle()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 30

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 30
rs 9.44
c 0
b 0
f 0
cc 2
nc 2
nop 0
1
<?php
2
3
namespace BeyondCode\LaravelWebSockets\Database\Console;
4
5
use Illuminate\Console\Command;
6
use BeyondCode\LaravelWebSockets\Database\Models\App;
7
8
class AppCreate extends Command
9
{
10
    protected $signature = 'websockets:app:create';
11
12
    protected $description = 'Create an app and save it on database.';
13
14
    public function handle()
15
    {
16
        $name = $this->ask('What is the app name? (required)');
17
18
        if (empty($name)) {
19
            $this->handle();
20
21
            return;
22
        }
23
24
        $host = $this->ask('Host: ');
25
26
        $enable_client_messages = $this->confirm('Would you enable client messages?');
27
28
        $enable_statistics = $this->confirm('Would you enable statistics?');
29
30
        $this->comment('Creating your application, please wait...');
31
32
        $app = App::create([
0 ignored issues
show
Bug introduced by
The method create() does not exist on BeyondCode\LaravelWebSockets\Database\Models\App. Did you maybe mean created()?

This check marks calls to methods that do not seem to exist on an object.

This is most likely the result of a method being renamed without all references to it being renamed likewise.

Loading history...
33
            'name' => $name,
34
            'host' => $host,
35
            'enable_client_messages' => $enable_client_messages,
36
            'enable_statistics' => $enable_statistics,
37
        ]);
38
39
        $this->info('Key: '.$app->key);
40
        $this->info('Secret: '.$app->secret);
41
42
        $this->comment('App has been created. Please save key and secret.');
43
    }
44
}
45