Total Complexity | 1 |
Total Lines | 52 |
Duplicated Lines | 0 % |
Coverage | 0% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
12 | class DictOption extends Model |
||
13 | { |
||
14 | use HasFactory; |
||
15 | |||
16 | protected $table = 'lgp_dict_option'; |
||
17 | |||
18 | /** |
||
19 | * @var array |
||
20 | */ |
||
21 | protected $fillable = [ |
||
22 | 'name', |
||
23 | 'json', |
||
24 | 'dict_id', |
||
25 | ]; |
||
26 | |||
27 | /** |
||
28 | * The attributes that should be hidden for arrays. |
||
29 | * |
||
30 | * @var array |
||
31 | */ |
||
32 | protected $hidden = []; |
||
33 | |||
34 | /** |
||
35 | * The attributes that should be casted to native types. |
||
36 | * |
||
37 | * @var array |
||
38 | */ |
||
39 | protected $casts = [ |
||
40 | 'id' => 'integer', |
||
41 | 'name' => 'string', |
||
42 | 'json' => AsArrayObject::class, |
||
43 | 'dict_id' => 'integer', |
||
44 | ]; |
||
45 | |||
46 | /** |
||
47 | * Validation rules |
||
48 | * |
||
49 | * @var array |
||
50 | */ |
||
51 | public static $rules = [ |
||
52 | 'name' => 'required', |
||
53 | 'dict_id' => 'required', |
||
54 | ]; |
||
55 | |||
56 | /** |
||
57 | * Get dict for option |
||
58 | * |
||
59 | * @return BelongsTo |
||
60 | */ |
||
61 | public function dict(): BelongsTo |
||
66 |