new widget structure

This commit is contained in:
denisdulici
2019-12-31 02:20:10 +03:00
parent 8c6ca5e5fb
commit 71c5caf264
44 changed files with 333 additions and 502 deletions

View File

@ -16,14 +16,7 @@ class Widget extends Model
*
* @var array
*/
protected $fillable = ['company_id', 'name', 'alias', 'settings', 'enabled'];
/**
* Sortable columns.
*
* @var array
*/
public $sortable = ['name', 'alias', 'enabled'];
protected $fillable = ['company_id', 'dashboard_id', 'class', 'name', 'settings', 'sort'];
/**
* The attributes that should be casted to native types.
@ -31,16 +24,11 @@ class Widget extends Model
* @var array
*/
protected $casts = [
'settings' => 'array',
'settings' => 'object',
];
public function dashboard_widgets()
public function dashboard()
{
return $this->hasMany('App\Models\Common\DashboardWidget');
}
public function dashboard_widget()
{
return $this->belongsTo('App\Models\Common\DashboardWidget', 'id', 'widget_id')->where('dashboard_id', 1);
return $this->belongsTo('App\Models\Common\Dashboard');
}
}