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

UserCustomerBookmark::getSlugAttribute()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

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