Dict::options()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
ccs 0
cts 2
cp 0
rs 10
cc 1
nc 1
nop 0
crap 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace GarbuzIvan\LaravelGeneratorPackage\Models;
6
7
use Illuminate\Database\Eloquent\Factories\HasFactory;
8
use Illuminate\Database\Eloquent\Model;
9
use Illuminate\Database\Eloquent\Relations\HasMany;
10
11
class Dict extends Model
12
{
13
    use HasFactory;
14
15
    protected $table = 'lgp_dict';
16
17
    /**
18
     * @var array
19
     */
20
    protected $fillable = [
21
        'name',
22
    ];
23
24
    /**
25
     * The attributes that should be hidden for arrays.
26
     *
27
     * @var array
28
     */
29
    protected $hidden = [];
30
31
    /**
32
     * The attributes that should be casted to native types.
33
     *
34
     * @var array
35
     */
36
    protected $casts = [
37
        'id' => 'integer',
38
        'name' => 'string',
39
    ];
40
41
    /**
42
     * Validation rules
43
     *
44
     * @var array
45
     */
46
    public static $rules = [
47
        'name' => 'required',
48
    ];
49
50
    /**
51
     * List option for dict
52
     *
53
     * @return hasMany
54
     */
55
    public function options(): hasMany
56
    {
57
        return $this->hasMany(DictOption::class, 'dict_id', 'id');
58
    }
59
}
60