forked from librenms/librenms
-
Notifications
You must be signed in to change notification settings - Fork 0
/
UserWidget.php
33 lines (26 loc) · 925 Bytes
/
UserWidget.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasOne;
class UserWidget extends Model
{
public $timestamps = false;
protected $table = 'users_widgets';
protected $primaryKey = 'user_widget_id';
protected $fillable = ['user_id', 'widget_id', 'col', 'row', 'size_x', 'size_y', 'title', 'refresh', 'settings', 'dashboard_id'];
protected $casts = ['settings' => 'array'];
// ---- Define Relationships ----
public function user(): BelongsTo
{
return $this->belongsTo(\App\Models\User::class, 'user_id');
}
public function widget(): HasOne
{
return $this->hasOne(\App\Models\Widget::class, 'widget_id');
}
public function dashboard(): BelongsTo
{
return $this->belongsTo(\App\Models\Dashboard::class, 'dashboard_id');
}
}