mirror of
https://github.com/sp-tarkov/forge.git
synced 2025-02-13 04:30:41 -05:00
67 lines
1.4 KiB
PHP
67 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Contracts\Auth\MustVerifyEmail;
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
|
use Illuminate\Foundation\Auth\User as Authenticatable;
|
|
use Illuminate\Notifications\Notifiable;
|
|
use Laravel\Fortify\TwoFactorAuthenticatable;
|
|
use Laravel\Jetstream\HasProfilePhoto;
|
|
use Laravel\Sanctum\HasApiTokens;
|
|
use Laravel\Scout\Searchable;
|
|
|
|
class User extends Authenticatable implements MustVerifyEmail
|
|
{
|
|
use HasApiTokens;
|
|
use HasFactory;
|
|
use HasProfilePhoto;
|
|
use Notifiable;
|
|
use Searchable;
|
|
use TwoFactorAuthenticatable;
|
|
|
|
protected $fillable = [
|
|
'name',
|
|
'email',
|
|
'password',
|
|
];
|
|
|
|
protected $hidden = [
|
|
'password',
|
|
'remember_token',
|
|
'two_factor_recovery_codes',
|
|
'two_factor_secret',
|
|
];
|
|
|
|
protected $appends = [
|
|
'profile_photo_url',
|
|
];
|
|
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'email_verified_at' => 'datetime',
|
|
'password' => 'hashed',
|
|
];
|
|
}
|
|
|
|
public function mods(): HasMany
|
|
{
|
|
return $this->hasMany(Mod::class);
|
|
}
|
|
|
|
public function toSearchableArray(): array
|
|
{
|
|
return [
|
|
'id' => (int) $this->id,
|
|
'name' => $this->name,
|
|
];
|
|
}
|
|
|
|
public function shouldBeSearchable(): bool
|
|
{
|
|
return ! is_null($this->email_verified_at);
|
|
}
|
|
}
|