Completed
Pull Request — master (#90)
by
unknown
02:19
created

AppCreate   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 1
dl 0
loc 36
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A handle() 0 29 2
1
<?php
2
3
namespace BeyondCode\LaravelWebSockets\Database\Console;
4
5
use BeyondCode\LaravelWebSockets\Database\Models\App;
6
use Carbon\Carbon;
7
use Illuminate\Console\Command;
8
use Illuminate\Database\Eloquent\Builder;
9
10
class AppCreate extends Command
11
{
12
    protected $signature = 'websockets:app:create';
13
14
    protected $description = 'Create an app and save it on database.';
15
16
    public function handle()
17
    {
18
        $name = $this->ask("What is the app name? (required)");
19
20
        if (empty($name)) {
21
            $this->handle();
22
            return;
23
        }
24
25
        $host = $this->ask("Host: ");
26
27
        $enable_client_messages = $this->confirm('Would you enable client messages?');
28
29
        $enable_statistics = $this->confirm('Would you enable statistics?');
30
31
        $this->comment('Creating your application, please wait...');
32
33
        $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...
34
            'name' => $name,
35
            'host' => $host,
36
            'enable_client_messages' => $enable_client_messages,
37
            'enable_statistics' => $enable_statistics
38
        ]);
39
40
        $this->info("Key: ". $app->key);
41
        $this->info("Secret: ". $app->secret);
42
43
        $this->comment('App has been created. Please save key and secret.');
44
    }
45
}
46