Completed
Pull Request — develop (#98)
by Neil
17:48
created

Rule::alert()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
ccs 0
cts 4
cp 0
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 2
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
use Illuminate\Database\Eloquent\Builder;
30
31
32
/**
33
 *
34
 */
35
class Rule extends Model
36
{
37
    /**
38
     * Indicates if the model should be timestamped.
39
     *
40
     * @var bool
41
     */
42
    public $timestamps = false;
43
    /**
44
     * The table associated with the model.
45
     *
46
     * @var string
47
     */
48
    protected $table = 'alert_rules';
49
    /**
50
     * The primary key column name.
51
     *
52
     * @var string
53
     */
54
    protected $primaryKey = 'id';
55
56
    // ---- Define Reletionships ----
57
58
    /**
59
     * @return \Illuminate\Database\Eloquent\Relations\hasMany
60
     */
61
    public function alert()
62
    {
63
        return $this->hasMany('App\Models\Alerting\Alert', 'rule_id');
64
    }
65
66
    /**
67
     * @return \Illuminate\Database\Eloquent\Relations\belongsTo
0 ignored issues
show
Documentation introduced by
Should the return type not be \Illuminate\Database\Eloquent\Relations\HasMany?

This check compares the return type specified in the @return annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.

Loading history...
68
     */
69
    public function device()
70
    {
71
        return $this->hasMany('App\Models\DEvice', 'device_id');
72
    }
73
74
}
75