UserRelationship::roles()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 4
dl 0
loc 6
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace App\Models\Access\User\Traits\Relationship;
4
5
use App\Models\Access\User\SocialLogin;
6
use App\Models\System\Session;
7
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
8
use Illuminate\Database\Eloquent\Relations\HasMany;
9
10
/**
11
 * Class UserRelationship.
12
 */
13
trait UserRelationship
14
{
15
    public function roles(): ?BelongsToMany
16
    {
17
        return $this->belongsToMany(config('access.role'),
0 ignored issues
show
Bug introduced by
It seems like belongsToMany() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

17
        return $this->/** @scrutinizer ignore-call */ belongsToMany(config('access.role'),
Loading history...
18
            config('access.role_user_table'),
19
            'user_id',
20
            'role_id');
21
    }
22
23
    public function providers(): ?HasMany
24
    {
25
        return $this->hasMany(SocialLogin::class);
0 ignored issues
show
Bug introduced by
It seems like hasMany() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

25
        return $this->/** @scrutinizer ignore-call */ hasMany(SocialLogin::class);
Loading history...
26
    }
27
28
    public function sessions(): ?HasMany
29
    {
30
        return $this->hasMany(Session::class);
31
    }
32
}
33