Completed
Push — master ( d42b43...5ac77a )
by ARCANEDEV
8s
created

UserRelationships   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 0
dl 0
loc 18
c 0
b 0
f 0
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A roles() 0 6 1
1
<?php namespace Arcanedev\LaravelAuth\Models\Relationships;
2
3
use Arcanedev\LaravelAuth\Models\Role;
4
5
/**
6
 * Trait     UserRelationships
7
 *
8
 * @package  Arcanedev\LaravelAuth\Traits
9
 * @author   ARCANEDEV <[email protected]>
10
 *
11
 * @method  \Illuminate\Database\Eloquent\Relations\BelongsToMany  belongsToMany(string $related, string $table = null, string $foreignKey = null, string $otherKey = null, string $relation = null)
12
 */
13
trait UserRelationships
14
{
15
    /* ------------------------------------------------------------------------------------------------
16
     |  Relationships
17
     | ------------------------------------------------------------------------------------------------
18
     */
19
    /**
20
     * User belongs to many roles.
21
     *
22
     * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
23
     */
24
    public function roles()
25
    {
26
        $model = config('laravel-auth.roles.model', Role::class);
27
28
        return $this->belongsToMany($model, 'role_user', 'user_id', 'role_id')->withTimestamps();
29
    }
30
}
31