CustomerEquipmentData::getFieldNameAttribute()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 1
c 2
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
namespace App\Models;
4
5
use Illuminate\Database\Eloquent\Model;
6
use Illuminate\Database\Eloquent\Factories\HasFactory;
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
    /*
17
    *   The name of the field this value data belongs to
18
    */
19
    public function getFieldNameAttribute()
20
    {
21
        return DataField::with('DataFieldType')->find($this->field_id)->DataFieldType->name;
22
    }
23
}
24