2019-11-16 10:21:14 +03:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Models\Common;
|
|
|
|
|
|
|
|
use App\Abstracts\Model;
|
|
|
|
use Bkwld\Cloner\Cloneable;
|
|
|
|
|
|
|
|
class Dashboard extends Model
|
|
|
|
{
|
|
|
|
use Cloneable;
|
|
|
|
|
|
|
|
protected $table = 'dashboards';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Attributes that should be mass-assignable.
|
|
|
|
*
|
|
|
|
* @var array
|
|
|
|
*/
|
2020-01-07 17:15:00 +03:00
|
|
|
protected $fillable = ['company_id', 'name', 'enabled'];
|
2019-11-16 10:21:14 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Sortable columns.
|
|
|
|
*
|
|
|
|
* @var array
|
|
|
|
*/
|
|
|
|
public $sortable = ['name', 'enabled'];
|
|
|
|
|
2020-01-07 17:15:00 +03:00
|
|
|
public function users()
|
2019-11-16 10:21:14 +03:00
|
|
|
{
|
2020-01-07 17:15:00 +03:00
|
|
|
return $this->morphedByMany('App\Models\Auth\User', 'user', 'user_dashboards', 'dashboard_id', 'user_id');
|
2019-11-16 10:21:14 +03:00
|
|
|
}
|
|
|
|
|
2019-12-31 11:27:49 +03:00
|
|
|
public function widgets()
|
2019-11-16 10:21:14 +03:00
|
|
|
{
|
2019-12-31 11:27:49 +03:00
|
|
|
return $this->hasMany('App\Models\Common\Widget')->orderBy('sort', 'asc');
|
2019-11-16 10:21:14 +03:00
|
|
|
}
|
|
|
|
}
|