Migration   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 2
eloc 4
c 2
b 0
f 0
dl 0
loc 20
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A getConnection() 0 3 1
1
<?php
2
3
/*
4
 * This file is part of Laravel Love.
5
 *
6
 * (c) Anton Komarev <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
declare(strict_types=1);
13
14
namespace Cog\Laravel\Love\Support\Database;
15
16
use Illuminate\Database\Migrations\Migration as IlluminateMigration;
17
use Illuminate\Support\Facades\Config;
18
use Illuminate\Support\Facades\Schema;
19
20
abstract class Migration extends IlluminateMigration
21
{
22
    /**
23
     * The database schema.
24
     *
25
     * @var \Illuminate\Database\Schema\Builder
26
     */
27
    protected $schema;
28
29
    public function __construct()
30
    {
31
        $this->schema = Schema::connection($this->getConnection());
32
    }
33
34
    /**
35
     * Get the migration connection name.
36
     */
37
    public function getConnection(): string | null
38
    {
39
        return Config::get('love.storage.database.connection');
40
    }
41
}
42