User   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 67
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 5

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A favoriteTopics() 0 4 1
A topics() 0 4 1
A getPresenterClass() 0 4 1
1
<?php
2
3
namespace PHPHub;
4
5
use McCool\LaravelAutoPresenter\HasPresenter;
6
use PHPHub\Presenters\UserPresenter;
7
use Illuminate\Database\Eloquent\Model;
8
use Illuminate\Auth\Passwords\CanResetPassword;
9
use Illuminate\Auth\Authenticatable;
10
use Illuminate\Foundation\Auth\Access\Authorizable;
11
use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract;
12
use Illuminate\Contracts\Auth\Access\Authorizable as AuthorizableContract;
13
use Illuminate\Contracts\Auth\CanResetPassword as CanResetPasswordContract;
14
15
class User extends Model implements HasPresenter, 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...
Coding Style introduced by
Only one interface may be specified per line in a multi-line implements declaration
Loading history...
16
    AuthorizableContract,
17
    CanResetPasswordContract
18
{
19
    use Authenticatable, Authorizable, CanResetPassword;
20
21
    public static $includable = [
22
        'id',
23
        'name',
24
        'avatar',
25
        'topic_count',
26
        'reply_count',
27
        'notification_count',
28
        'is_banned',
29
        'twitter_account',
30
        'company',
31
        'city',
32
        'email',
33
        'signature',
34
        'introduction',
35
        'github_name',
36
        'github_url',
37
        'real_name',
38
        'personal_website',
39
        'created_at',
40
        'updated_at',
41
    ];
42
43
    protected $fillable = [
44
        'real_name',
45
        'city',
46
        'company',
47
        'twitter_account',
48
        'personal_website',
49
        'signature',
50
        'introduction',
51
    ];
52
53
    protected $casts = [
54
        'id'                 => 'int',
55
        'github_id'          => 'int',
56
        'topic_count'        => 'int',
57
        'reply_count'        => 'int',
58
        'notification_count' => 'int',
59
        'is_banned'          => 'boolean',
60
    ];
61
62
    public function topics()
63
    {
64
        return $this->hasMany(Topic::class);
65
    }
66
67
    public function favoriteTopics()
68
    {
69
        return $this->belongsToMany(Topic::class, 'favorites')->withPivot('created_at');
70
    }
71
72
    /**
73
     * Get the presenter class.
74
     *
75
     * @return string
76
     */
77
    public function getPresenterClass()
78
    {
79
        return UserPresenter::class;
80
    }
81
}
82