TenantAwareSeeder::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
c 0
b 0
f 0
nc 1
nop 1
dl 0
loc 3
rs 10
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