2018-09-11 07:51:35 -05:00
|
|
|
<?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', 'user_id');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function widget()
|
|
|
|
|
{
|
2018-12-16 15:18:17 -06:00
|
|
|
return $this->hasOne('App\Models\Widget', 'widget_id');
|
2018-09-11 07:51:35 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function dashboard()
|
|
|
|
|
{
|
|
|
|
|
return $this->belongsTo('App\Models\Dashboard', 'dashboard_id');
|
|
|
|
|
}
|
|
|
|
|
}
|