Completed
Pull Request — master (#83)
by James
01:40
created

RunMigrationsSolution   A

Complexity

Total Complexity 9

Size/Duplication

Total Lines 50
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 9
lcom 1
cbo 1
dl 0
loc 50
rs 10
c 0
b 0
f 0

8 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getSolutionTitle() 0 7 2
A getSolutionDescription() 0 4 1
A getDocumentationLinks() 0 6 1
A getRunParameters() 0 4 1
A getSolutionActionDescription() 0 4 1
A getRunButtonText() 0 4 1
A run() 0 4 1
1
<?php
2
3
namespace Facade\Ignition\Solutions;
4
5
use Illuminate\Support\Facades\Artisan;
6
use Facade\IgnitionContracts\RunnableSolution;
7
8
class RunMigrationsSolution implements RunnableSolution
9
{
10
11
    private $customTitle;
12
13
    public function __construct($customTitle = null)
14
    {
15
        $this->customTitle = $customTitle;
16
    }
17
18
    public function getSolutionTitle(): string
19
    {
20
        if (isset($this->customTitle)) {
21
            return $this->customTitle;
22
        }
23
        return 'A table was not found';
24
    }
25
26
    public function getSolutionDescription(): string
27
    {
28
        return 'You might have forgotten to run your migrations. You can run your migrations using `php artisan migrate`.';
29
    }
30
31
    public function getDocumentationLinks(): array
32
    {
33
        return [
34
            'Database: Running Migrations docs' => 'https://laravel.com/docs/5.8/migrations#running-migrations',
35
        ];
36
    }
37
38
    public function getRunParameters(): array
39
    {
40
        return [];
41
    }
42
43
    public function getSolutionActionDescription(): string
44
    {
45
        return 'Pressing the button below will try to run your migrations.';
46
    }
47
48
    public function getRunButtonText(): string
49
    {
50
        return 'Run migrations';
51
    }
52
53
    public function run(array $parameters = [])
54
    {
55
        Artisan::call('migrate');
56
    }
57
}
58