Files
librenms-librenms/app/Models/UserWidget.php
Tony Murray 32f1ce494e Dashboard code cleanup (#13996)
* Dashboard Cleanup
Remove static widgets table, list of available widgets should not be in the database.
Remove legacy ajax scripts
Cleanup and reorganize controllers

* reorganize code to put all dashboard things into it's controller
better url scheme while supporting the original

* lint clean ups

* properly formatted language file

* style fixes

* update schema
2022-05-31 08:08:40 -05:00

28 lines
751 B
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
class UserWidget extends Model
{
public $timestamps = false;
protected $table = 'users_widgets';
protected $primaryKey = 'user_widget_id';
protected $fillable = ['user_id', 'widget', '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 dashboard(): BelongsTo
{
return $this->belongsTo(\App\Models\Dashboard::class, 'dashboard_id');
}
}