Completed
Push — device-groups ( 54870b )
by Tony
08:56
created

DeviceGroup   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
c 1
b 0
f 0
lcom 0
cbo 1
dl 0
loc 33
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A devices() 0 4 1
1
<?php
2
/**
3
 * DeviceGroup.php
4
 *
5
 * Dynamic groups of devices
6
 *
7
 * This program is free software: you can redistribute it and/or modify
8
 * it under the terms of the GNU General Public License as published by
9
 * the Free Software Foundation, either version 3 of the License, or
10
 * (at your option) any later version.
11
 *
12
 * This program is distributed in the hope that it will be useful,
13
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
15
 * GNU General Public License for more details.
16
 *
17
 * You should have received a copy of the GNU General Public License
18
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
 *
20
 * @package    LibreNMS
21
 * @link       http://librenms.org
22
 * @copyright  2016 Tony Murray
23
 * @author     Tony Murray <[email protected]>
24
 */
25
26
namespace App\Models;
27
28
use Illuminate\Database\Eloquent\Model;
29
30
class DeviceGroup extends Model
31
{
32
    /**
33
     * Indicates if the model should be timestamped.
34
     *
35
     * @var bool
36
     */
37
    public $timestamps = false;
38
    /**
39
     * The table associated with the model.
40
     *
41
     * @var string
42
     */
43
    protected $table = 'device_groups';
44
    /**
45
     * The primary key column name.
46
     *
47
     * @var string
48
     */
49
    protected $primaryKey = 'id';
50
51
    // ---- Define Relationships ----
52
53
    /**
54
     * Relationship to App\Models\Device
55
     *
56
     * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
57
     */
58
    public function devices()
59
    {
60
        return $this->belongsToMany('App\Models\Device', 'device_group_device', 'device_group_id', 'device_id');
61
    }
62
}
63