Completed
Push — master ( 3f6bda...9e3353 )
by Joao
03:40
created

Group::users()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace jlourenco\base\Models;
4
5
use Illuminate\Database\Eloquent\Model;
6
use Cartalyst\Sentinel\Permissions\PermissibleInterface;
7
use Cartalyst\Sentinel\Permissions\PermissibleTrait;
8
9
class Group extends \Cartalyst\Sentinel\Roles\EloquentRole
10
{
11
12
    /**
13
     * {@inheritDoc}
14
     */
15
    protected $table = 'Group';
16
17
    /**
18
     * {@inheritDoc}
19
     */
20
    protected $fillable = [
21
        'name',
22
        'slug',
23
        'permissions',
24
        'description',
25
    ];
26
27
    /**
28
     * The Users relationship.
29
     *
30
     * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
31
     */
32
    public function users()
33
    {
34
        return $this->belongsToMany(static::$usersModel, 'Group_User', 'group', 'user')->withTimestamps();
35
    }
36
37
    /**
38
     * The Menus relationship.
39
     *
40
     * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
41
     */
42
    public function menus()
43
    {
44
        return $this->belongsToMany('App\Menu', 'Menu_Group', 'group', 'menu')->withTimestamps();
45
    }
46
47
}
48