Completed
Push — develop ( 5f1168...aa9d13 )
by Daniel
05:30
created

Port   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 42
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 42
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A device() 0 3 1
A users() 0 3 1
1
<?php
2
3
namespace App;
4
5
use Illuminate\Database\Eloquent\Model;
6
7
class Port extends Model
8
{
9
    /**
10
     * The table associated with the model.
11
     *
12
     * @var string
13
     */
14
    protected $table = 'ports';
15
16
    /**
17
     * The primary key column name.
18
     *
19
     * @var string
20
     */
21
    protected $primaryKey = 'port_id';
22
23
    /**
24
     * Indicates if the model should be timestamped.
25
     *
26
     * @var bool
27
     */
28
    public $timestamps = false;
29
30
31
    // ---- Define Reletionships ----
32
33
    /**
34
     * Get the device this port belongs to.
35
     *
36
     */
37
    public function device() {
38
        return $this->belongsTo('App\Device', 'device_id', 'device_id');
39
    }
40
41
    /**
42
     * Returns a list of users that can access this port.
43
     */
44
    public function users() {
45
        return $this->belongsToMany('App\User', 'ports_perms', 'port_id', 'user_id');
46
    }
47
48
}
49