1 | <?php |
||
2 | |||
3 | namespace Uccello\Core\Models; |
||
4 | |||
5 | use Uccello\Core\Database\Eloquent\Model; |
||
6 | |||
7 | class Block extends Model |
||
8 | { |
||
9 | /** |
||
10 | * The table associated with the model. |
||
11 | * |
||
12 | * @var string |
||
13 | */ |
||
14 | protected $table = 'blocks'; |
||
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 | 'tab_id', |
||
33 | 'label', |
||
34 | 'icon', |
||
35 | 'description', |
||
36 | 'sequence', |
||
37 | 'data', |
||
38 | ]; |
||
39 | |||
40 | protected function initTablePrefix() |
||
41 | { |
||
42 | $this->tablePrefix = env('UCCELLO_TABLE_PREFIX', 'uccello_'); |
||
43 | } |
||
44 | |||
45 | public function tab() |
||
46 | { |
||
47 | return $this->belongsTo(Tab::class); |
||
48 | } |
||
49 | |||
50 | public function fields() |
||
51 | { |
||
52 | return $this->hasMany(Field::class)->orderBy('sequence'); |
||
53 | } |
||
54 | |||
55 | public function getDescriptionAttribute() |
||
56 | { |
||
57 | return $this->data->description ?? null; |
||
0 ignored issues
–
show
|
|||
58 | } |
||
59 | } |
||
60 |
Checks if undeclared accessed properties appear in database migrations and if the creating migration is correct.