Completed
Push — notifications ( d054ca...4f3de2 )
by Tony
02:41
created

UsersWidgets::widget()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace App\Models;
4
5
use Illuminate\Database\Eloquent\Model;
6
7
/**
8
 * App\Models\UsersWidgets
9
 *
10
 * @property integer $user_widget_id
11
 * @property integer $user_id
12
 * @property integer $widget_id
13
 * @property boolean $col
14
 * @property boolean $row
15
 * @property boolean $size_x
16
 * @property boolean $size_y
17
 * @property string $title
18
 * @property boolean $refresh
19
 * @property string $settings
20
 * @property integer $dashboard_id
21
 * @method static \Illuminate\Database\Query\Builder|\App\Models\UsersWidgets whereUserWidgetId($value)
22
 * @method static \Illuminate\Database\Query\Builder|\App\Models\UsersWidgets whereUserId($value)
23
 * @method static \Illuminate\Database\Query\Builder|\App\Models\UsersWidgets whereWidgetId($value)
24
 * @method static \Illuminate\Database\Query\Builder|\App\Models\UsersWidgets whereCol($value)
25
 * @method static \Illuminate\Database\Query\Builder|\App\Models\UsersWidgets whereRow($value)
26
 * @method static \Illuminate\Database\Query\Builder|\App\Models\UsersWidgets whereSizeX($value)
27
 * @method static \Illuminate\Database\Query\Builder|\App\Models\UsersWidgets whereSizeY($value)
28
 * @method static \Illuminate\Database\Query\Builder|\App\Models\UsersWidgets whereTitle($value)
29
 * @method static \Illuminate\Database\Query\Builder|\App\Models\UsersWidgets whereRefresh($value)
30
 * @method static \Illuminate\Database\Query\Builder|\App\Models\UsersWidgets whereSettings($value)
31
 * @method static \Illuminate\Database\Query\Builder|\App\Models\UsersWidgets whereDashboardId($value)
32
 * @mixin \Eloquent
33
 * @property-read \App\Models\User $user
34
 * @property-read \App\Models\Widgets $widget
35
 * @property-read \App\Models\Dashboard $dashboard
36
 */
37
class UsersWidgets extends Model
38
{
39
    /**
40
     * Indicates if the model should be timestamped.
41
     *
42
     * @var bool
43
     */
44
    public $timestamps = false;
45
    /**
46
     * The table associated with the model.
47
     *
48
     * @var string
49
     */
50
    protected $table = 'users_widgets';
51
    /**
52
     * The primary key column name.
53
     *
54
     * @var string
55
     */
56
    protected $primaryKey = 'user_widget_id';
57
    /**
58
     * The attributes that are mass assignable.
59
     *
60
     * @var array
61
     */
62
    protected $fillable = ['user_id', 'widget_id', 'col', 'row', 'size_x', 'size_y', 'title', 'refresh', 'settings', 'dashboard_id'];
63
64
    // ---- Define Relationships ----
65
66
    /**
67
     * @return \Illuminate\Database\Eloquent\Relations\HasOne
68
     */
69
    public function user()
70
    {
71
        return $this->belongsTo('App\Models\User', 'user_id');
72
    }
73
74
    /**
75
     * @return \Illuminate\Database\Eloquent\Relations\HasOne
76
     */
77
    public function widget()
78
    {
79
        return $this->hasOne('App\Models\Widgets', 'widget_id');
80
    }
81
82
    /**
83
     * @return \Illuminate\Database\Eloquent\Relations\HasOne
84
     */
85
    public function dashboard()
86
    {
87
        return $this->belongsTo('App\Models\Dashboard', 'dashboard_id');
88
    }
89
90
}
91