Completed
Push — master ( 12b7f0...82e836 )
by Ryan
02:24
created

DashboardModel::boot()   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.4286
cc 1
eloc 3
nc 1
nop 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A DashboardModel::getSlug() 0 4 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\UsersModule\Role\RoleCollection;
7
8
/**
9
 * Class DashboardModel
10
 *
11
 * @link          http://anomaly.is/streams-platform
12
 * @author        AnomalyLabs, Inc. <[email protected]>
13
 * @author        Ryan Thompson <[email protected]>
14
 * @package       Anomaly\DashboardModule\Dashboard
15
 */
16
class DashboardModel extends DashboardDashboardsEntryModel implements DashboardInterface
17
{
18
19
    /**
20
     * Get the slug.
21
     *
22
     * @return string
23
     */
24
    public function getSlug()
25
    {
26
        return $this->slug;
27
    }
28
29
    /**
30
     * Get the name.
31
     *
32
     * @return string
33
     */
34
    public function getName()
35
    {
36
        return $this->name;
37
    }
38
39
    /**
40
     * Get the allowed roles.
41
     *
42
     * @return RoleCollection
43
     */
44
    public function getAllowedRoles()
45
    {
46
        return $this->allowedRoles()->get();
47
    }
48
49
    /**
50
     * Get the related widgets.
51
     *
52
     * @return \Anomaly\Streams\Platform\Entry\EntryPresenter|mixed
53
     */
54
    public function getWidgets()
55
    {
56
        return $this->widgets;
57
    }
58
59
    /**
60
     * Return the widget relation.
61
     *
62
     * @return \Illuminate\Database\Eloquent\Relations\HasMany
63
     */
64
    public function widgets()
65
    {
66
        return $this->hasMany(WidgetModel::class, 'dashboard_id');
67
    }
68
}
69