Database   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 8
dl 0
loc 43
rs 10
c 0
b 0
f 0
wmc 4

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getTableName() 0 3 1
A getConnectionName() 0 3 1
A __construct() 0 5 2
1
<?php
2
3
namespace jeremykenedy\LaravelRoles\Database;
4
5
use Illuminate\Database\Eloquent\Model;
6
7
abstract class Database extends Model
8
{
9
    /**
10
     * The table associated with the model.
11
     *
12
     * @var string
13
     */
14
    protected $table;
15
16
    /**
17
     * The connection name for the model.
18
     *
19
     * @var string
20
     */
21
    protected $connection;
22
23
    /**
24
     * Create a new instance to set the table and connection.
25
     *
26
     * @return void
27
     */
28
    public function __construct($attributes = [])
29
    {
30
        parent::__construct($attributes);
31
        if ($connection = config('roles.connection')) {
32
            $this->connection = $connection;
33
        }
34
    }
35
36
    /**
37
     * Get the database connection.
38
     */
39
    public function getConnectionName()
40
    {
41
        return $this->connection;
42
    }
43
44
    /**
45
     * Get the database table.
46
     */
47
    public function getTableName()
48
    {
49
        return $this->table;
50
    }
51
}
52