ModelSettings   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 6
c 1
b 0
f 0
dl 0
loc 23
ccs 6
cts 6
cp 1
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A model() 0 3 1
1
<?php
2
3
namespace Glorand\Model\Settings\Models;
4
5
use Illuminate\Database\Eloquent\Model;
6
use Illuminate\Database\Eloquent\Relations\MorphTo;
7
8
/**
9
 * Class ModelSettings
10
 * @package Glorand\Model\Settings\Models
11
 * @property array $settings
12
 */
13
class ModelSettings extends Model
14
{
15
    /**
16
     * ModelSettings constructor.
17
     * @param array $attributes
18
     */
19 42
    public function __construct(array $attributes = [])
20
    {
21 42
        parent::__construct($attributes);
22
23 42
        $this->setTable(config('model_settings.settings_table_name', 'model_settings'));
24 42
    }
25
26
    protected $casts = [
27
        'settings' => 'json',
28
    ];
29
30
    /**
31
     * @return \Illuminate\Database\Eloquent\Relations\MorphTo
32
     */
33 39
    public function model(): MorphTo
34
    {
35 39
        return $this->morphTo();
36
    }
37
}
38