Passed
Push — master ( 2f9657...00b148 )
by Tony
08:56
created

MplsLspPath::getCompositeKey()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace App\Models;
4
5
use Illuminate\Database\Eloquent\Model;
6
use LibreNMS\Interfaces\Models\Keyable;
7
8
class MplsLspPath extends Model implements Keyable
9
{
10
    protected $primaryKey = 'lsp_path_id';
11
    public $timestamps = false;
12
    protected $fillable = [
13
        'lsp_id',
14
        'path_oid',
15
        'device_id',
16
        'mplsLspPathRowStatus',
17
        'mplsLspPathLastChange',
18
        'mplsLspPathType',
19
        'mplsLspPathBandwidth',
20
        'mplsLspPathOperBandwidth',
21
        'mplsLspPathAdminState',
22
        'mplsLspPathOperState',
23
        'mplsLspPathState',
24
        'mplsLspPathFailCode',
25
        'mplsLspPathFailNodeAddr',
26
        'mplsLspPathMetric',
27
        'mplsLspPathOperMetric',
28
        'mplsLspPathTimeUp',
29
        'mplsLspPathTimeDown',
30
        'mplsLspPathTransitionCount',
31
    ];
32
33
    // ---- Helper Functions ----
34
35
    /**
36
     * Get a string that can identify a unique instance of this model
37
     * @return string
38
     */
39
    public function getCompositeKey()
40
    {
41
        return $this->lsp_id . '-' . $this->path_oid;
42
    }
43
44
    // ---- Define Relationships ----
45
46
    public function lsp()
47
    {
48
        return $this->belongsTo('App\Models\MplsLsp', 'lsp_id');
49
    }
50
}
51