mirror of
https://gh.wpcy.net/https://github.com/aspirepress/AspireCloud.git
synced 2026-05-31 00:04:27 +08:00
81 lines
2 KiB
PHP
81 lines
2 KiB
PHP
<?php
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Models;
|
|
|
|
// use Illuminate\Contracts\Auth\MustVerifyEmail;
|
|
use App\Auth\Role;
|
|
use Carbon\Carbon;
|
|
use Database\Factories\UserFactory;
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Foundation\Auth\User as Authenticatable;
|
|
use Illuminate\Notifications\DatabaseNotification;
|
|
use Illuminate\Notifications\DatabaseNotificationCollection;
|
|
use Illuminate\Notifications\Notifiable;
|
|
use Laravel\Fortify\TwoFactorAuthenticatable;
|
|
use Laravel\Jetstream\HasProfilePhoto;
|
|
use Laravel\Sanctum\HasApiTokens;
|
|
use Laravel\Sanctum\PersonalAccessToken;
|
|
use Spatie\Permission\Traits\HasRoles;
|
|
|
|
/**
|
|
* @property int $id
|
|
* @property string $name
|
|
* @property string $email
|
|
* @property Carbon|null $email_verified_at
|
|
* @property string $password
|
|
* @property string|null $remember_token
|
|
* @property Carbon|null $created_at
|
|
* @property Carbon|null $updated_at
|
|
* @property-read DatabaseNotificationCollection<int, DatabaseNotification> $notifications
|
|
* @property-read int|null $notifications_count
|
|
*/
|
|
class User extends Authenticatable
|
|
{
|
|
/** @use HasApiTokens<PersonalAccessToken> */
|
|
use HasApiTokens;
|
|
|
|
/** @use HasFactory<UserFactory> */
|
|
use HasFactory;
|
|
|
|
use HasRoles;
|
|
use HasProfilePhoto;
|
|
use Notifiable;
|
|
use TwoFactorAuthenticatable;
|
|
|
|
protected static function booted(): void
|
|
{
|
|
static::created(function (User $user) {
|
|
$user->assignRole(Role::User);
|
|
});
|
|
}
|
|
|
|
/** @var list<string> */
|
|
protected $fillable = [
|
|
'name',
|
|
'email',
|
|
'password',
|
|
];
|
|
|
|
/** @var list<string> */
|
|
protected $hidden = [
|
|
'password',
|
|
'remember_token',
|
|
'two_factor_recovery_codes',
|
|
'two_factor_secret',
|
|
];
|
|
|
|
/** @var list<string> */
|
|
protected $appends = [
|
|
'profile_photo_url',
|
|
];
|
|
|
|
/** @return array<string, string> */
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'email_verified_at' => 'datetime',
|
|
'password' => 'hashed',
|
|
];
|
|
}
|
|
}
|