RoleRelationship::permissions()   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\Role\Traits\Relationship;
4
5
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
6
7
/**
8
 * Class RoleRelationship.
9
 */
10
trait RoleRelationship
11
{
12
    public function users(): ?BelongsToMany
13
    {
14
        return $this->belongsToMany(config('auth.providers.users.model'),
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

14
        return $this->/** @scrutinizer ignore-call */ belongsToMany(config('auth.providers.users.model'),
Loading history...
15
            config('access.role_user_table'),
16
            'role_id',
17
            'user_id');
18
    }
19
20
    public function permissions(): ?BelongsToMany
21
    {
22
        return $this->belongsToMany(config('access.permission'),
23
            config('access.permission_role_table'),
24
            'role_id',
25
            'permission_id')->orderBy('display_name', 'asc');
26
    }
27
}
28