Completed
Pull Request — master (#107)
by Tim
30:29 queued 22:15
created

User   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 47
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 5

Importance

Changes 2
Bugs 0 Features 1
Metric Value
wmc 2
c 2
b 0
f 1
lcom 0
cbo 5
dl 0
loc 47
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A departmentManager() 0 4 1
A teams() 0 4 1
1
<?php
2
3
namespace App;
4
5
use Illuminate\Auth\Authenticatable;
6
use Illuminate\Database\Eloquent\Model;
7
use Illuminate\Auth\Passwords\CanResetPassword;
8
use Illuminate\Foundation\Auth\Access\Authorizable;
9
use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract;
10
use Illuminate\Contracts\Auth\Access\Authorizable as AuthorizableContract;
11
use Illuminate\Contracts\Auth\CanResetPassword as CanResetPasswordContract;
12
use Silber\Bouncer\Database\HasRolesAndAbilities;
13
14
class User extends Model implements AuthenticatableContract,
0 ignored issues
show
Coding Style introduced by
The first item in a multi-line implements list must be on the line following the implements keyword
Loading history...
15
                                    AuthorizableContract,
0 ignored issues
show
Coding Style introduced by
Expected 4 spaces before interface name; 36 found
Loading history...
16
                                    CanResetPasswordContract
0 ignored issues
show
Coding Style introduced by
Expected 4 spaces before interface name; 36 found
Loading history...
17
{
18
    use Authenticatable, Authorizable, CanResetPassword, HasRolesAndAbilities;
19
20
    /**
21
     * The database table used by the model.
22
     *
23
     * @var string
24
     */
25
    protected $table = 'users';
26
27
    /**
28
     * The attributes that are mass assignable.
29
     *
30
     * @var array
31
     */
32
    protected $fillable = ['name', 'fname', 'address', 'postal_code', 'city', 'country', 'email', 'password'];
33
34
    /**
35
     * The attributes excluded from the model's JSON form.
36
     *
37
     * @var array
38
     */
39
    protected $hidden = ['password', 'remember_token'];
40
41
    /**
42
     * Return the departments where the user is manager off.
43
     *
44
     * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
45
     */
46
    public function departmentManager()
47
    {
48
        return $this->belongsToMany('App\Departments');
49
    }
50
51
    /**
52
     * Return the teams where the user is in.
53
     *
54
     * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
55
     */
56
    public function teams()
57
    {
58
        return $this->belongsToMany('App\Teams');
59
    }
60
}
61