Completed
Pull Request — master (#107)
by Glenn
11:49 queued 05:48
created

User::departmentManager()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
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