Completed
Pull Request — develop (#106)
by Neil
20:39
created

Eventlog::device()   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 2
Bugs 0 Features 2
Metric Value
c 2
b 0
f 2
dl 0
loc 4
ccs 0
cts 2
cp 0
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 2
1
<?php
2
3
namespace App\Models\General;
4
5
use Illuminate\Database\Eloquent\Model;
6
use Illuminate\Database\Eloquent\Builder;
7
8
/**
9
 * App\Models\General\Eventlog
10
 *
11
 * @property integer $device_id
12
 * @property string $hostname
13
 * @property string $sysName
14
 * @property mixed $ip
15
 * @property string $community
16
 * @property string $authlevel
17
 * @property string $authname
18
 * @property string $authpass
19
 * @property string $authalgo
20
 * @property string $cryptopass
21
 * @property string $cryptoalgo
22
 * @property string $snmpver
23
 * @property integer $port
24
 * @property string $transport
25
 * @property integer $timeout
26
 * @property integer $retries
27
 * @property string $bgpLocalAs
28
 * @property string $sysObjectID
29
 * @property string $sysDescr
30
 * @property string $sysContact
31
 * @property string $version
32
 * @property string $hardware
33
 * @property string $features
34
 * @property string $location
35
 * @property string $os
36
 * @property boolean $status
37
 * @property string $status_reason
38
 * @property boolean $ignore
39
 * @property boolean $disabled
40
 * @property integer $uptime
41
 * @property integer $agent_uptime
42
 * @property string $last_polled
43
 * @property string $last_poll_attempted
44
 * @property float $last_polled_timetaken
45
 * @property float $last_discovered_timetaken
46
 * @property string $last_discovered
47
 * @property string $last_ping
48
 * @property float $last_ping_timetaken
49
 * @property string $purpose
50
 * @property string $type
51
 * @property string $serial
52
 * @property string $icon
53
 * @property integer $poller_group
54
 * @property boolean $override_sysLocation
55
 * @property string $notes
56
 * @method static \Illuminate\Database\Query\Builder|\App\Models\Eventlog whereDeviceId($value)
57
 * @method static \Illuminate\Database\Query\Builder|\App\Models\Eventlog whereHostname($value)
58
 * @method static \Illuminate\Database\Query\Builder|\App\Models\Eventlog whereSysName($value)
59
 * @method static \Illuminate\Database\Query\Builder|\App\Models\Eventlog whereIp($value)
60
 * @method static \Illuminate\Database\Query\Builder|\App\Models\Eventlog whereCommunity($value)
61
 * @method static \Illuminate\Database\Query\Builder|\App\Models\Eventlog whereAuthlevel($value)
62
 * @method static \Illuminate\Database\Query\Builder|\App\Models\Eventlog whereAuthname($value)
63
 * @method static \Illuminate\Database\Query\Builder|\App\Models\Eventlog whereAuthpass($value)
64
 * @method static \Illuminate\Database\Query\Builder|\App\Models\Eventlog whereAuthalgo($value)
65
 * @method static \Illuminate\Database\Query\Builder|\App\Models\Eventlog whereCryptopass($value)
66
 * @method static \Illuminate\Database\Query\Builder|\App\Models\Eventlog whereCryptoalgo($value)
67
 * @method static \Illuminate\Database\Query\Builder|\App\Models\Eventlog whereSnmpver($value)
68
 * @method static \Illuminate\Database\Query\Builder|\App\Models\Eventlog wherePort($value)
69
 * @method static \Illuminate\Database\Query\Builder|\App\Models\Eventlog whereTransport($value)
70
 * @method static \Illuminate\Database\Query\Builder|\App\Models\Eventlog whereTimeout($value)
71
 * @method static \Illuminate\Database\Query\Builder|\App\Models\Eventlog whereRetries($value)
72
 * @method static \Illuminate\Database\Query\Builder|\App\Models\Eventlog whereBgpLocalAs($value)
73
 * @method static \Illuminate\Database\Query\Builder|\App\Models\Eventlog whereSysObjectID($value)
74
 * @method static \Illuminate\Database\Query\Builder|\App\Models\Eventlog whereSysDescr($value)
75
 * @method static \Illuminate\Database\Query\Builder|\App\Models\Eventlog whereSysContact($value)
76
 * @method static \Illuminate\Database\Query\Builder|\App\Models\Eventlog whereVersion($value)
77
 * @method static \Illuminate\Database\Query\Builder|\App\Models\Eventlog whereHardware($value)
78
 * @method static \Illuminate\Database\Query\Builder|\App\Models\Eventlog whereFeatures($value)
79
 * @method static \Illuminate\Database\Query\Builder|\App\Models\Eventlog whereLocation($value)
80
 * @method static \Illuminate\Database\Query\Builder|\App\Models\Eventlog whereOs($value)
81
 * @method static \Illuminate\Database\Query\Builder|\App\Models\Eventlog whereStatus($value)
82
 * @method static \Illuminate\Database\Query\Builder|\App\Models\Eventlog whereStatusReason($value)
83
 * @method static \Illuminate\Database\Query\Builder|\App\Models\Eventlog whereIgnore($value)
84
 * @method static \Illuminate\Database\Query\Builder|\App\Models\Eventlog whereDisabled($value)
85
 * @method static \Illuminate\Database\Query\Builder|\App\Models\Eventlog whereUptime($value)
86
 * @method static \Illuminate\Database\Query\Builder|\App\Models\Eventlog whereAgentUptime($value)
87
 * @method static \Illuminate\Database\Query\Builder|\App\Models\Eventlog whereLastPolled($value)
88
 * @method static \Illuminate\Database\Query\Builder|\App\Models\Eventlog whereLastPollAttempted($value)
89
 * @method static \Illuminate\Database\Query\Builder|\App\Models\Eventlog whereLastPolledTimetaken($value)
90
 * @method static \Illuminate\Database\Query\Builder|\App\Models\Eventlog whereLastDiscoveredTimetaken($value)
91
 * @method static \Illuminate\Database\Query\Builder|\App\Models\Eventlog whereLastDiscovered($value)
92
 * @method static \Illuminate\Database\Query\Builder|\App\Models\Eventlog whereLastPing($value)
93
 * @method static \Illuminate\Database\Query\Builder|\App\Models\Eventlog whereLastPingTimetaken($value)
94
 * @method static \Illuminate\Database\Query\Builder|\App\Models\Eventlog wherePurpose($value)
95
 * @method static \Illuminate\Database\Query\Builder|\App\Models\Eventlog whereType($value)
96
 * @method static \Illuminate\Database\Query\Builder|\App\Models\Eventlog whereSerial($value)
97
 * @method static \Illuminate\Database\Query\Builder|\App\Models\Eventlog whereIcon($value)
98
 * @method static \Illuminate\Database\Query\Builder|\App\Models\Eventlog wherePollerGroup($value)
99
 * @method static \Illuminate\Database\Query\Builder|\App\Models\Eventlog whereOverrideSysLocation($value)
100
 * @method static \Illuminate\Database\Query\Builder|\App\Models\Eventlog whereNotes($value)
101
 * @mixin \Eloquent
102
 */
103
class Eventlog extends Model
104
{
105
    /**
106
     * Indicates if the model should be timestamped.
107
     *
108
     * @var bool
109
     */
110
    public $timestamps = false;
111
    /**
112
     * The table associated with the model.
113
     *
114
     * @var string
115
     */
116
    protected $table = 'eventlog';
117
    /**
118
     * The primary key column name.
119
     *
120
     * @var string
121
     */
122
    protected $primaryKey = 'event_id';
123
124
125
    // ---- Accessors/Mutators ----
126
127
128
    // ---- Define Reletionships ----
129
130
    /**
131
     * Returns the device this entry belongs to.
132
     */
133
    public function device()
134
    {
135
        return $this->belongsToOne('App\Models\Device', 'device_id', 'host');
0 ignored issues
show
Documentation Bug introduced by
The method belongsToOne does not exist on object<App\Models\General\Eventlog>? Since you implemented __call, maybe consider adding a @method annotation.

If you implement __call and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.

This is often the case, when __call is implemented by a parent class and only the child class knows which methods exist:

class ParentClass {
    private $data = array();

    public function __call($method, array $args) {
        if (0 === strpos($method, 'get')) {
            return $this->data[strtolower(substr($method, 3))];
        }

        throw new \LogicException(sprintf('Unsupported method: %s', $method));
    }
}

/**
 * If this class knows which fields exist, you can specify the methods here:
 *
 * @method string getName()
 */
class SomeClass extends ParentClass { }
Loading history...
136
    }
137
}
138