Passed
Push — main ( d04005...d016cc )
by Garbuz
02:22
created

Dict   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 47
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
eloc 12
c 1
b 0
f 0
dl 0
loc 47
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A options() 0 3 1
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