Files
librenms-librenms/app/Models/UserWidget.php
Jellyfrog 36e54ab9f1 Use model::class instead of string for binding (#11450)
* Use model::class instead of string for binding

Originally from laravel shift

Shift bindings

PHP 5.5.9+ adds the new static `class` property which provides the fully qualified class name. This is preferred over using class name strings as these references are checked by the parser.

* Shift cleanup
2020-04-21 07:28:48 -05:00

33 lines
800 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 ----
public function user()
{
return $this->belongsTo(\App\Models\User::class, 'user_id');
}
public function widget()
{
return $this->hasOne(\App\Models\Widget::class, 'widget_id');
}
public function dashboard()
{
return $this->belongsTo(\App\Models\Dashboard::class, 'dashboard_id');
}
}