Passed
Pull Request — master (#76)
by
unknown
20:16
created

PanelAdmin::__construct()   A

Complexity

Conditions 2
Paths 1

Size

Total Lines 9
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 4
nc 1
nop 1
dl 0
loc 9
rs 10
c 1
b 0
f 0
1
<?php
2
3
4
namespace EasyPanel\Models;
5
6
7
use Illuminate\Database\Eloquent\Model;
8
9
class PanelAdmin extends Model
10
{
11
12
    /**
13
    * Create a new Eloquent model instance.
14
    *
15
    * @param array $attributes
16
    */
17
    public function __construct(array $attributes = [])
18
    {
19
        $connection = config('easy_panel_config.database.connection') ?: config('database.default');
20
21
        $this->setConnection($connection);
22
23
        $this->setTable(config('easy_panel_config.database.panel_admin_table'));
24
25
        parent::__construct($attributes);
26
    }
27
28
    protected $guarded = [];
29
30
    public function user()
31
    {
32
        return $this->belongsTo(config('easy_panel.user_model'));
33
    }
34
}
35