| Total Complexity | 4 |
| Total Lines | 43 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 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() |
||
| 50 | } |
||
| 51 | } |
||
| 52 |