Initial commit
This commit is contained in:
commit
b105bd7db7
171 changed files with 28322 additions and 0 deletions
58
app/User.php
Normal file
58
app/User.php
Normal file
|
@ -0,0 +1,58 @@
|
|||
<?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';
|
||||
}
|
||||
|
||||
}
|
Reference in a new issue