Completed
Push — master ( 0380c2...02776d )
by wen
56:13
created

User   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A setPasswordAttribute() 0 7 2
1
<?php
2
3
4
namespace Sco\Admin\Models;
5
6
use Illuminate\Foundation\Auth\User as Authenticatable;
7
use Zizaco\Entrust\Traits\EntrustUserTrait;
8
9
class User extends Authenticatable
10
{
11
    use EntrustUserTrait;
12
13
    protected $visible = ['id', 'name', 'email', 'created_at', 'roles'];
14
15
    protected $guarded = ['created_at', 'updated_at'];
16
17
    protected $hidden = ['password'];
18
19
    protected $fillable = ['name', 'email', 'password'];
20
21
    protected $events = [
22
        'created'  => \Sco\ActionLog\Events\ModelWasCreated::class,
23
        'updated'  => \Sco\ActionLog\Events\ModelWasUpdated::class,
24
        'deleted'  => \Sco\ActionLog\Events\ModelWasDeleted::class,
25
    ];
26
27
    public function setPasswordAttribute($value)
28
    {
29
        if (empty($value)) {
30
            return;
31
        }
32
        $this->attributes['password'] = bcrypt($value);
33
    }
34
}
35