DashboardModel::getAllowedRoles()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
c 0
b 0
f 0
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php namespace Anomaly\DashboardModule\Dashboard;
2
3
use Anomaly\DashboardModule\Dashboard\Contract\DashboardInterface;
4
use Anomaly\DashboardModule\Widget\WidgetModel;
5
use Anomaly\Streams\Platform\Model\Dashboard\DashboardDashboardsEntryModel;
6
use Anomaly\Streams\Platform\Model\EloquentCollection;
7
use Anomaly\UsersModule\Role\RoleCollection;
8
9
/**
10
 * Class DashboardModel
11
 *
12
 * @link          http://pyrocms.com/
13
 * @author        PyroCMS, Inc. <[email protected]>
14
 * @author        Ryan Thompson <[email protected]>
15
 */
16
class DashboardModel extends DashboardDashboardsEntryModel implements DashboardInterface
17
{
18
19
    /**
20
     * The active flag.
21
     *
22
     * @var bool
23
     */
24
    protected $active = false;
25
26
    /**
27
     * Eager loaded relations.
28
     *
29
     * @var array
30
     */
31
    protected $with = [
32
        'translations',
33
    ];
34
35
    /**
36
     * Get the active flag.
37
     *
38
     * @return bool
39
     */
40
    public function isActive()
41
    {
42
        return $this->active;
43
    }
44
45
    /**
46
     * Set the active flag.
47
     *
48
     * @param $active
49
     * @return $this
50
     */
51
    public function setActive($active)
52
    {
53
        $this->active = $active;
54
55
        return $this;
56
    }
57
58
    /**
59
     * Get the slug.
60
     *
61
     * @return string
62
     */
63
    public function getSlug()
64
    {
65
        return $this->slug;
66
    }
67
68
    /**
69
     * Get the name.
70
     *
71
     * @return string
72
     */
73
    public function getName()
74
    {
75
        return $this->name;
76
    }
77
78
    /**
79
     * Get the allowed roles.
80
     *
81
     * @return RoleCollection
82
     */
83
    public function getAllowedRoles()
84
    {
85
        return $this->allowed_roles;
86
    }
87
88
    /**
89
     * Get the related widgets.
90
     *
91
     * @return \Anomaly\Streams\Platform\Entry\EntryPresenter|mixed
92
     */
93
    public function getWidgets()
94
    {
95
        return $this->widgets;
96
    }
97
98
    /**
99
     * Return the widget relation.
100
     *
101
     * @return \Illuminate\Database\Eloquent\Relations\HasMany
102
     */
103
    public function widgets()
104
    {
105
        return $this->hasMany(WidgetModel::class, 'dashboard_id');
106
    }
107
}
108