Completed
Push — master ( e6463a...a91b31 )
by Ryan
02:20
created

DashboardModel::setActive()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

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