Completed
Pull Request — develop (#37)
by
unknown
07:01
created

Port::formatBps()   A

Complexity

Conditions 2
Paths 1

Size

Total Lines 11
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 2 Features 1
Metric Value
c 2
b 2
f 1
dl 0
loc 11
rs 9.4285
cc 2
eloc 7
nc 1
nop 3
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
    // ---- Accessors/Mutators ----
32
33
34
    // ---- Define Reletionships ----
35
36
    /**
37
     * Get the device this port belongs to.
38
     *
39
     */
40
    public function device() {
41
        return $this->belongsTo('App\Device', 'device_id', 'device_id');
42
    }
43
44
    /**
45
     * Returns a list of users that can access this port.
46
     */
47
    public function users() {
48
        return $this->belongsToMany('App\User', 'ports_perms', 'port_id', 'user_id');
49
    }
50
51
}
52