mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
42 lines
1023 B
PHP
42 lines
1023 B
PHP
![]() |
<?php
|
||
|
|
||
|
namespace App\Models;
|
||
|
|
||
|
use Auth;
|
||
|
use Illuminate\Database\Eloquent\Model;
|
||
|
|
||
|
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 ----
|
||
|
|
||
|
/**
|
||
|
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||
|
*/
|
||
|
public function user()
|
||
|
{
|
||
|
return $this->belongsTo('App\Models\User', 'user_id');
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* @return \Illuminate\Database\Eloquent\Relations\HasOne
|
||
|
*/
|
||
|
public function widget()
|
||
|
{
|
||
|
return $this->hasOne('App\Models\Widgets', 'widget_id');
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||
|
*/
|
||
|
public function dashboard()
|
||
|
{
|
||
|
return $this->belongsTo('App\Models\Dashboard', 'dashboard_id');
|
||
|
}
|
||
|
}
|