Passed
Push — dev6 ( ab7c89...794b39 )
by Ron
15:37
created

UserCustomerBookmark   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 3
eloc 8
dl 0
loc 21
rs 10
c 2
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getNameAttribute() 0 3 1
A Customer() 0 3 1
A getSlugAttribute() 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 UserCustomerBookmark extends Model
9
{
10
    use HasFactory;
11
12
    protected $guarded      = ['updated_at', 'created_at'];
13
    protected $hidden       = ['updated_at', 'created_at', 'Customer', 'id', 'user_id'];
14
    protected $appends      = ['name', 'slug'];
15
16
    public function Customer()
17
    {
18
        return $this->belongsTo(Customer::class, 'cust_id', 'cust_id');
19
    }
20
21
    public function getNameAttribute()
22
    {
23
        return $this->Customer->name;
24
    }
25
26
    public function getSlugAttribute()
27
    {
28
        return $this->Customer->slug;
29
    }
30
}
31