1 | <?php |
||
15 | class User extends Model implements HasPresenter, AuthenticatableContract, |
||
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() |
||
71 | |||
72 | /** |
||
73 | * Get the presenter class. |
||
74 | * |
||
75 | * @return string |
||
76 | */ |
||
77 | public function getPresenterClass() |
||
81 | } |
||
82 |