Rule   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

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

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
 * App\Models\Alerting\Rule
32
 *
33
 * @property integer $id
34
 * @property string $device_id
35
 * @property string $rule
36
 * @property string $severity
37
 * @property string $extra
38
 * @property boolean $disabled
39
 * @property string $name
40
 * @property string $proc
41
 * @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\Alerting\Alert[] $alert
42
 * @property-read \App\Models\Device $device
43
 * @method static \Illuminate\Database\Query\Builder|\App\Models\Alerting\Rule whereId($value)
44
 * @method static \Illuminate\Database\Query\Builder|\App\Models\Alerting\Rule whereDeviceId($value)
45
 * @method static \Illuminate\Database\Query\Builder|\App\Models\Alerting\Rule whereRule($value)
46
 * @method static \Illuminate\Database\Query\Builder|\App\Models\Alerting\Rule whereSeverity($value)
47
 * @method static \Illuminate\Database\Query\Builder|\App\Models\Alerting\Rule whereExtra($value)
48
 * @method static \Illuminate\Database\Query\Builder|\App\Models\Alerting\Rule whereDisabled($value)
49
 * @method static \Illuminate\Database\Query\Builder|\App\Models\Alerting\Rule whereName($value)
50
 * @method static \Illuminate\Database\Query\Builder|\App\Models\Alerting\Rule whereProc($value)
51
 * @mixin \Eloquent
52
 * @property string $query
53
 * @method static \Illuminate\Database\Query\Builder|\App\Models\Alerting\Rule whereQuery($value)
54
 */
55
class Rule extends Model
56
{
57
    /**
58
     * Indicates if the model should be timestamped.
59
     *
60
     * @var bool
61
     */
62
    public $timestamps = false;
63
    /**
64
     * The table associated with the model.
65
     *
66
     * @var string
67
     */
68
    protected $table = 'alert_rules';
69
    /**
70
     * The primary key column name.
71
     *
72
     * @var string
73
     */
74
    protected $primaryKey = 'id';
75
76
    // ---- Define Relationships ----
77
78
    /**
79
     * @return \Illuminate\Database\Eloquent\Relations\HasMany
80
     */
81
    public function alert()
82
    {
83
        return $this->hasMany('App\Models\Alerting\Alert', 'rule_id');
84
    }
85
86
    /**
87
     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
88
     */
89
    public function device()
90
    {
91
        return $this->belongsTo('App\Models\Device', 'device_id');
92
    }
93
}
94