269 lines
5.6 KiB
PHP
269 lines
5.6 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
// use Illuminate\Contracts\Auth\MustVerifyEmail;
|
|
use Database\Factories\UserFactory;
|
|
use Eloquent;
|
|
use Illuminate\Database\Eloquent\Builder;
|
|
use Illuminate\Database\Eloquent\Collection;
|
|
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 Illuminate\Support\Carbon;
|
|
use Laravel\Sanctum\HasApiTokens;
|
|
use Laravel\Sanctum\PersonalAccessToken;
|
|
|
|
/**
|
|
* App\Models\User
|
|
*
|
|
* @property int $id
|
|
* @property string $name
|
|
* @property string $email
|
|
* @property Carbon|null $email_verified_at
|
|
* @property mixed $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
|
|
* @property-read Collection<int, PersonalAccessToken> $tokens
|
|
* @property-read int|null $tokens_count
|
|
* @method static UserFactory factory($count = null, $state = [])
|
|
* @method static Builder|User newModelQuery()
|
|
* @method static Builder|User newQuery()
|
|
* @method static Builder|User query()
|
|
* @method static Builder|User whereCreatedAt($value)
|
|
* @method static Builder|User whereEmail($value)
|
|
* @method static Builder|User whereEmailVerifiedAt($value)
|
|
* @method static Builder|User whereId($value)
|
|
* @method static Builder|User whereName($value)
|
|
* @method static Builder|User wherePassword($value)
|
|
* @method static Builder|User whereRememberToken($value)
|
|
* @method static Builder|User whereUpdatedAt($value)
|
|
* @mixin Eloquent
|
|
*/
|
|
class User extends Authenticatable
|
|
{
|
|
use HasApiTokens, HasFactory, Notifiable;
|
|
|
|
/**
|
|
* The attributes that are mass assignable.
|
|
*
|
|
* @var array<int, string>
|
|
*/
|
|
protected $fillable = [
|
|
'name',
|
|
'email',
|
|
'password',
|
|
];
|
|
/**
|
|
* The attributes that should be hidden for serialization.
|
|
*
|
|
* @var array<int, string>
|
|
*/
|
|
protected $hidden = [
|
|
'password',
|
|
'remember_token',
|
|
];
|
|
/**
|
|
* The attributes that should be cast.
|
|
*
|
|
* @var array<string, string>
|
|
*/
|
|
protected $casts = [
|
|
'email_verified_at' => 'datetime',
|
|
'password' => 'hashed',
|
|
];
|
|
|
|
/**
|
|
* @return int
|
|
*/
|
|
public function getId(): int
|
|
{
|
|
return $this->id;
|
|
}
|
|
|
|
/**
|
|
* @param int $id
|
|
*
|
|
* @return User
|
|
*/
|
|
public function setId(int $id): User
|
|
{
|
|
$this->id = $id;
|
|
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* @return string
|
|
*/
|
|
public function getName(): string
|
|
{
|
|
return $this->name;
|
|
}
|
|
|
|
/**
|
|
* @param string $name
|
|
*
|
|
* @return User
|
|
*/
|
|
public function setName(string $name): User
|
|
{
|
|
$this->name = $name;
|
|
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* @return string
|
|
*/
|
|
public function getEmail(): string
|
|
{
|
|
return $this->email;
|
|
}
|
|
|
|
/**
|
|
* @param string $email
|
|
*
|
|
* @return User
|
|
*/
|
|
public function setEmail(string $email): User
|
|
{
|
|
$this->email = $email;
|
|
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* @return Carbon|null
|
|
*/
|
|
public function getEmailVerifiedAt(): ?Carbon
|
|
{
|
|
return $this->email_verified_at;
|
|
}
|
|
|
|
/**
|
|
* @param Carbon|null $email_verified_at
|
|
*
|
|
* @return User
|
|
*/
|
|
public function setEmailVerifiedAt(?Carbon $email_verified_at): User
|
|
{
|
|
$this->email_verified_at = $email_verified_at;
|
|
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* @return mixed
|
|
*/
|
|
public function getPassword(): mixed
|
|
{
|
|
return $this->password;
|
|
}
|
|
|
|
/**
|
|
* @param mixed $password
|
|
*
|
|
* @return User
|
|
*/
|
|
public function setPassword(mixed $password): User
|
|
{
|
|
$this->password = $password;
|
|
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* @return string|null
|
|
*/
|
|
public function getRememberToken(): ?string
|
|
{
|
|
return $this->remember_token;
|
|
}
|
|
|
|
/**
|
|
* @return DatabaseNotificationCollection
|
|
*/
|
|
public function getNotifications(): DatabaseNotificationCollection
|
|
{
|
|
return $this->notifications;
|
|
}
|
|
|
|
/**
|
|
* @param DatabaseNotificationCollection $notifications
|
|
*
|
|
* @return User
|
|
*/
|
|
public function setNotifications(DatabaseNotificationCollection $notifications): User
|
|
{
|
|
$this->notifications = $notifications;
|
|
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* @return int|null
|
|
*/
|
|
public function getNotificationsCount(): ?int
|
|
{
|
|
return $this->notifications_count;
|
|
}
|
|
|
|
/**
|
|
* @param int|null $notifications_count
|
|
*
|
|
* @return User
|
|
*/
|
|
public function setNotificationsCount(?int $notifications_count): User
|
|
{
|
|
$this->notifications_count = $notifications_count;
|
|
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* @return Collection
|
|
*/
|
|
public function getTokens(): Collection
|
|
{
|
|
return $this->tokens;
|
|
}
|
|
|
|
/**
|
|
* @param Collection $tokens
|
|
*
|
|
* @return User
|
|
*/
|
|
public function setTokens(Collection $tokens): User
|
|
{
|
|
$this->tokens = $tokens;
|
|
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* @return int|null
|
|
*/
|
|
public function getTokensCount(): ?int
|
|
{
|
|
return $this->tokens_count;
|
|
}
|
|
|
|
/**
|
|
* @param int|null $tokens_count
|
|
*
|
|
* @return User
|
|
*/
|
|
public function setTokensCount(?int $tokens_count): User
|
|
{
|
|
$this->tokens_count = $tokens_count;
|
|
|
|
return $this;
|
|
}
|
|
}
|