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

CRUD::__construct()   A

Complexity

Conditions 2
Paths 1

Size

Total Lines 9
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

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