TenantAwareSeeder   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 5
c 0
b 0
f 0
dl 0
loc 32
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A connection() 0 3 1
A setConnection() 0 3 1
1
<?php
2
3
namespace App\Services;
4
5
use Illuminate\Database\Seeder;
6
7
abstract class TenantAwareSeeder extends Seeder
8
{
9
    /**
10
     * The name of the default connection.
11
     *
12
     * @var string
13
     */
14
    protected $connection;
15
16
    public function __construct(string $connection)
17
    {
18
        $this->connection = $connection;
19
    }
20
21
    public static function connection(string $connection): TenantAwareSeeder
22
    {
23
        return new static($connection);
24
    }
25
26
    /**
27
     * Set the default connection name.
28
     *
29
     * @param string $connection
30
     *
31
     * @return void
32
     */
33
    public function setConnection(string $connection)
34
    {
35
        $this->connection = $connection;
36
    }
37
38
    abstract public function run();
39
}
40