Passed
Push — dev5 ( e66ef8...5a922b )
by Ron
05:53
created

CustomerSystems   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Test Coverage

Coverage 66.67%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 8
dl 0
loc 31
ccs 4
cts 6
cp 0.6667
rs 10
c 1
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A SystemTypes() 0 3 1
A SystemDataFields() 0 3 1
A CustomerSystemData() 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'];
14
    protected $hidden = ['created_at', 'updated_at'];
15
16
    // public function Customers()
17
    // {
18
    //     return $this->belongsTo('App\customers', 'cust_id', 'cust_id');
19
    // }
20
21 4
    public function SystemTypes()
22
    {
23 4
        return $this->hasOne('App\SystemTypes', 'sys_id', 'sys_id');
24
    }
25
26
    public function CustomerSystemData()
27
    {
28
        return $this->hasMany('App\CustomerSystemData', 'cust_sys_id');
29
    }
30
31
    // public function SystemDataFields()
32
    // {
33
    //     return $this->hasManyThrough('App\SystemDataFields', 'App\CustomerSystemData', 'cust_sys_id', 'field_id', 'cust_sys_id', 'field_id');
34
    // }
35
36 2
    public function SystemDataFields()
37
    {
38 2
        return $this->belongsToMany('App\SystemDataFields', 'customer_system_data', 'cust_sys_id', 'field_id')->withPivot('value')->orderBy('order', 'ASC');
39
    }
40
}
41