librenms-librenms/app/Models/UserWidget.php

42 lines
1023 B
PHP
Raw Normal View History

<?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');
}
}