Test Setup Failed
Push — dev6 ( 81193f...01d104 )
by Ron
22:34
created

CustomerEquipmentData   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 11
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
eloc 6
c 1
b 0
f 0
dl 0
loc 11
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A getFieldNameAttribute() 0 3 1
1
<?php
2
3
namespace App\Models;
4
5
use Illuminate\Database\Eloquent\Factories\HasFactory;
6
use Illuminate\Database\Eloquent\Model;
7
8
class CustomerEquipmentData extends Model
9
{
10
    use HasFactory;
11
12
    protected $guarded = ['id', 'created_at', 'updated_at'];
13
    protected $hidden  = ['cust_equip_id', 'field_id', 'created_at', 'updated_at'];
14
    protected $appends = ['field_name'];
15
16
    public function getFieldNameAttribute()
17
    {
18
        return DataField::with('DataFieldType')->find($this->field_id)->DataFieldType->name;
19
    }
20
}
21