Passed
Push — master ( da797a...38c1ce )
by Gombos
03:26
created

ModelSettings::model()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
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 7
    public function __construct(array $attributes = [])
20
    {
21 7
        parent::__construct($attributes);
22
23 7
        $this->setTable(config('model_settings.settings_table_name', 'model_settings'));
24 7
    }
25
26
    protected $casts = [
27
        'settings' => 'json',
28
    ];
29
30
    /**
31
     * @return \Illuminate\Database\Eloquent\Relations\MorphTo
32
     */
33 6
    public function model(): MorphTo
34
    {
35 6
        return $this->morphTo();
36
    }
37
}
38