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

CustomerSystems::SystemDataFields()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 1
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 3
ccs 0
cts 2
cp 0
crap 2
rs 10
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