Passed
Push — master ( 8b2cae...538703 )
by Jeremy
02:24 queued 10s
created

Database::getTableName()   A

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