Passed
Push — dev5a ( 2c238c...96dd50 )
by Ron
07:38
created

CustomerSystems   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 9
c 1
b 0
f 0
dl 0
loc 22
ccs 6
cts 6
cp 1
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A SystemTypes() 0 3 1
A CustomerSystemData() 0 3 1
A getSysNameAttribute() 0 3 1
1
<?php
2
3
namespace App;
4
5
use Illuminate\Database\Eloquent\Model;
6
use Illuminate\Database\Eloquent\SoftDeletes;
7
8
class CustomerSystems extends Model
9
{
10
    use SoftDeletes;
11
12
    protected $primaryKey = 'cust_sys_id';
13
    protected $fillable   = ['cust_id', 'sys_id', 'shared'];
14
    protected $hidden     = ['created_at', 'updated_at', 'deleted_at', 'SystemTypes'];
15
    protected $appends    = ['sys_name'];
16
17 8
    public function SystemTypes()
18
    {
19 8
        return $this->hasOne('App\SystemTypes', 'sys_id', 'sys_id');
20
    }
21
22 6
    public function CustomerSystemData()
23
    {
24 6
        return $this->hasMany('App\CustomerSystemData', 'cust_sys_id');
25
    }
26
27 8
    public function getSysNameAttribute()
28
    {
29 8
        return $this->SystemTypes->name;
30
    }
31
}
32