Completed
Push — settings ( bea8d4...96499a )
by Tony
05:40
created

Rule   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A alert() 0 4 1
A device() 0 4 1
1
<?php
2
/**
3
 * app/Models/Alerting/Rule.php
4
 *
5
 * Model for access to alert_rules table data
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 Neil Lathwood
23
 * @author     Neil Lathwood <[email protected]>
24
 */
25
26
namespace App\Models\Alerting;
27
28
use Illuminate\Database\Eloquent\Model;
29
30
/**
31
 *
32
 */
33
class Rule extends Model
34
{
35
    /**
36
     * Indicates if the model should be timestamped.
37
     *
38
     * @var bool
39
     */
40
    public $timestamps = false;
41
    /**
42
     * The table associated with the model.
43
     *
44
     * @var string
45
     */
46
    protected $table = 'alert_rules';
47
    /**
48
     * The primary key column name.
49
     *
50
     * @var string
51
     */
52
    protected $primaryKey = 'id';
53
54
    // ---- Define Reletionships ----
55
56
    /**
57
     * @return \Illuminate\Database\Eloquent\Relations\hasMany
58
     */
59
    public function alert()
60
    {
61
        return $this->hasMany('App\Models\Alerting\Alert', 'rule_id');
62
    }
63
64
    /**
65
     * @return \Illuminate\Database\Eloquent\Relations\belongsTo
66
     */
67
    public function device()
68
    {
69
        return $this->belongsTo('App\Models\Device', 'device_id');
70
    }
71
72
}
73