HasSocialAttributes   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 0
dl 0
loc 22
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getSocialAttribute() 0 4 1
A scopeWithSocial() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Rinvex\Support\Traits;
6
7
use Illuminate\Database\Eloquent\Builder;
8
use Spatie\SchemalessAttributes\SchemalessAttributes;
9
10
trait HasSocialAttributes
11
{
12
    /**
13
     * Get social attributes.
14
     *
15
     * @return \Spatie\SchemalessAttributes\SchemalessAttributes
16
     */
17
    public function getSocialAttribute(): SchemalessAttributes
18
    {
19
        return SchemalessAttributes::createForModel($this, 'social');
20
    }
21
22
    /**
23
     * Scope with social attributes.
24
     *
25
     * @return \Illuminate\Database\Eloquent\Builder
26
     */
27
    public function scopeWithSocial(): Builder
28
    {
29
        return SchemalessAttributes::scopeWithSchemalessAttributes('social');
30
    }
31
}
32