2019-11-16 10:21:14 +03:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Models\Common;
|
|
|
|
|
|
|
|
use App\Abstracts\Model;
|
|
|
|
use Bkwld\Cloner\Cloneable;
|
2021-06-21 19:03:08 +03:00
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
2019-11-16 10:21:14 +03:00
|
|
|
|
|
|
|
class Widget extends Model
|
|
|
|
{
|
2021-06-21 19:03:08 +03:00
|
|
|
use Cloneable, HasFactory;
|
2019-11-16 10:21:14 +03:00
|
|
|
|
|
|
|
protected $table = 'widgets';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Attributes that should be mass-assignable.
|
|
|
|
*
|
|
|
|
* @var array
|
|
|
|
*/
|
2021-09-07 10:33:34 +03:00
|
|
|
protected $fillable = ['company_id', 'dashboard_id', 'class', 'name', 'sort', 'settings', 'created_from', 'created_by'];
|
2019-11-16 10:21:14 +03:00
|
|
|
|
|
|
|
/**
|
2020-11-13 15:15:27 +03:00
|
|
|
* The attributes that should be cast.
|
2019-11-16 10:21:14 +03:00
|
|
|
*
|
|
|
|
* @var array
|
|
|
|
*/
|
|
|
|
protected $casts = [
|
2019-12-31 02:20:10 +03:00
|
|
|
'settings' => 'object',
|
2019-11-16 10:21:14 +03:00
|
|
|
];
|
|
|
|
|
2019-12-31 02:20:10 +03:00
|
|
|
public function dashboard()
|
2019-11-16 10:21:14 +03:00
|
|
|
{
|
2019-12-31 02:20:10 +03:00
|
|
|
return $this->belongsTo('App\Models\Common\Dashboard');
|
2019-11-16 10:21:14 +03:00
|
|
|
}
|
2019-12-31 11:27:49 +03:00
|
|
|
|
2020-01-16 14:20:08 +03:00
|
|
|
public function users()
|
2019-12-31 11:27:49 +03:00
|
|
|
{
|
2020-01-16 14:20:08 +03:00
|
|
|
return $this->hasManyThrough('App\Models\Auth\User', 'App\Models\Common\Dashboard');
|
2019-12-31 11:27:49 +03:00
|
|
|
}
|
2021-06-21 19:03:08 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Create a new factory instance for the model.
|
|
|
|
*
|
|
|
|
* @return \Illuminate\Database\Eloquent\Factories\Factory
|
|
|
|
*/
|
|
|
|
protected static function newFactory()
|
|
|
|
{
|
|
|
|
return \Database\Factories\Widget::new();
|
|
|
|
}
|
2019-11-16 10:21:14 +03:00
|
|
|
}
|