Total Complexity | 6 |
Total Lines | 76 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
7 | class Widget extends Model |
||
8 | { |
||
9 | /** |
||
10 | * The table associated with the model. |
||
11 | * |
||
12 | * @var string |
||
13 | */ |
||
14 | protected $table = 'widgets'; |
||
15 | |||
16 | /** |
||
17 | * The attributes that should be casted to native types. |
||
18 | * |
||
19 | * @var array |
||
20 | */ |
||
21 | protected $casts = [ |
||
22 | 'data' => 'object', |
||
23 | ]; |
||
24 | |||
25 | /** |
||
26 | * The attributes that are mass assignable. |
||
27 | * |
||
28 | * @var array |
||
29 | */ |
||
30 | protected $fillable = [ |
||
31 | 'module_id', |
||
32 | 'label', |
||
33 | 'type', |
||
34 | 'class', |
||
35 | 'data', |
||
36 | ]; |
||
37 | |||
38 | protected function initTablePrefix() |
||
39 | { |
||
40 | $this->tablePrefix = env('UCCELLO_TABLE_PREFIX', 'uccello_'); |
||
41 | } |
||
42 | |||
43 | public function modules() |
||
46 | } |
||
47 | |||
48 | /** |
||
49 | * Returns full package name if it is defined, else returns null |
||
50 | * |
||
51 | * @return string|null |
||
52 | */ |
||
53 | public function getPackageAttribute() |
||
54 | { |
||
55 | return $this->data->package ?? null; |
||
|
|||
56 | } |
||
57 | |||
58 | /** |
||
59 | * Returns package name to use for translation if defined, else returns an empty string |
||
60 | * |
||
61 | * @return string |
||
62 | */ |
||
63 | public function getLanguagePackageAttribute() |
||
73 | } |
||
74 | |||
75 | /** |
||
76 | * Returns widget label for translation (with package name as prefix) |
||
77 | * |
||
78 | * @return string |
||
79 | */ |
||
80 | public function getLabelForTranslationAttribute() |
||
85 |
Checks if undeclared accessed properties appear in database migrations and if the creating migration is correct.