Model   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 2
eloc 4
c 2
b 0
f 0
dl 0
loc 14
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getTable() 0 4 1
A getConnectionName() 0 3 1
1
<?php
2
3
/*
4
 * This file is part of Laravel Love.
5
 *
6
 * (c) Anton Komarev <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
declare(strict_types=1);
13
14
namespace Cog\Laravel\Love\Support\Database\Eloquent;
15
16
use Illuminate\Database\Eloquent\Model as IlluminateModel;
17
use Illuminate\Support\Facades\Config;
18
19
abstract class Model extends IlluminateModel
20
{
21
    /**
22
     * Get the current connection name for the model.
23
     */
24
    public function getConnectionName(): string | null
25
    {
26
        return Config::get('love.storage.database.connection');
27
    }
28
29
    public function getTable(): string
30
    {
31
        return Config::get("love.storage.database.tables.{$this->table}")
32
            ?? $this->table;
33
    }
34
}
35