58 lines
1.2 KiB
PHP
58 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App;
|
|
|
|
use App\Cache\Cache;
|
|
use Illuminate\Contracts\Auth\MustVerifyEmail;
|
|
use Illuminate\Foundation\Auth\User as Authenticatable;
|
|
use Illuminate\Notifications\Notifiable;
|
|
|
|
class User extends Authenticatable implements MustVerifyEmail
|
|
{
|
|
use Notifiable;
|
|
|
|
protected $guard_name = 'web';
|
|
|
|
/**
|
|
* The attributes that are mass assignable.
|
|
*
|
|
* @var array
|
|
*/
|
|
protected $fillable = [
|
|
'uuid', 'email', 'password', 'google2fa_secret',
|
|
];
|
|
|
|
/**
|
|
* The attributes that should be hidden for arrays.
|
|
*
|
|
* @var array
|
|
*/
|
|
protected $hidden = [
|
|
'password', 'remember_token', 'google2fa_secret',
|
|
];
|
|
|
|
/**
|
|
* The attributes that should be cast to native types.
|
|
*
|
|
* @var array
|
|
*/
|
|
protected $casts = [
|
|
'email_verified_at' => 'datetime',
|
|
];
|
|
|
|
|
|
private $username;
|
|
public function username() {
|
|
if(!empty($this->username))
|
|
return $this->username;
|
|
|
|
$username = Cache::getUsername($this->uuid);
|
|
$this->username = $username;
|
|
return $username;
|
|
}
|
|
|
|
public function photo() {
|
|
return 'https://crafatar.com/avatars/'.$this->uuid.'?overlay';
|
|
}
|
|
|
|
}
|