Completed
Pull Request — master (#14)
by
unknown
15:13 queued 07:44
created

Admin   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A getAvatarUrlAttribute() 0 4 1
1
<?php
2
3
namespace Yaro\Jarboe\Models;
4
5
use Illuminate\Foundation\Auth\User as Authenticatable;
6
use Spatie\Permission\Traits\HasRoles;
7
use Yaro\Jarboe\Pack\Image;
8
9
class Admin extends Authenticatable
10
{
11
    use HasRoles;
12
13
    /**
14
     * The attributes that are mass assignable.
15
     *
16
     * @var array
17
     */
18
    protected $fillable = [
19
        'name',
20
        'email',
21
        'password',
22
        'avatar',
23
        'otp_secret',
24
    ];
25
26
    /**
27
     * The attributes that should be hidden for arrays.
28
     *
29
     * @var array
30
     */
31
    protected $hidden = [
32
        'password',
33
        'remember_token',
34
    ];
35
36
    protected $casts = [
37
        'avatar' => 'array',
38
    ];
39
40
    public function getAvatarUrlAttribute($value)
41
    {
42
        return (new Image($this->avatar))->croppedOrOriginalSourceUrl();
43
    }
44
}
45