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

RunMigrationsSolution   A

Complexity

Total Complexity 9

Size/Duplication

Total Lines 49
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 9
lcom 1
cbo 1
dl 0
loc 49
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
    private $customTitle;
11
12
    public function __construct($customTitle = null)
13
    {
14
        $this->customTitle = $customTitle;
15
    }
16
17
    public function getSolutionTitle(): string
18
    {
19
        if (isset($this->customTitle)) {
20
            return $this->customTitle;
21
        }
22
        return 'A table was not found';
23
    }
24
25
    public function getSolutionDescription(): string
26
    {
27
        return 'You might have forgotten to run your migrations. You can run your migrations using `php artisan migrate`.';
28
    }
29
30
    public function getDocumentationLinks(): array
31
    {
32
        return [
33
            'Database: Running Migrations docs' => 'https://laravel.com/docs/5.8/migrations#running-migrations',
34
        ];
35
    }
36
37
    public function getRunParameters(): array
38
    {
39
        return [];
40
    }
41
42
    public function getSolutionActionDescription(): string
43
    {
44
        return 'Pressing the button below will try to run your migrations.';
45
    }
46
47
    public function getRunButtonText(): string
48
    {
49
        return 'Run migrations';
50
    }
51
52
    public function run(array $parameters = [])
53
    {
54
        Artisan::call('migrate');
55
    }
56
}
57