akaunting/app/Models/Common/Widget.php

40 lines
771 B
PHP
Raw Normal View History

2019-11-16 10:21:14 +03:00
<?php
namespace App\Models\Common;
use App\Abstracts\Model;
use Bkwld\Cloner\Cloneable;
class Widget extends Model
{
use Cloneable;
protected $table = 'widgets';
/**
* Attributes that should be mass-assignable.
*
* @var array
*/
2019-12-31 02:20:10 +03:00
protected $fillable = ['company_id', 'dashboard_id', 'class', 'name', 'settings', 'sort'];
2019-11-16 10:21:14 +03:00
/**
* The attributes that should be casted to native types.
*
* @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
public function user()
{
return $this->hasOneThrough('App\Models\Auth\User', 'App\Models\Common\Dashboard');
}
2019-11-16 10:21:14 +03:00
}