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

CRUD   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 7
dl 0
loc 23
rs 10
c 1
b 0
f 0
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A scopeActive() 0 3 1
A __construct() 0 9 2
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