Add display_name (unique) and email_confirmed_at columns plus matching getters, DTO fields, repo methods (findByDisplayName, update), and migration. Existing auth tests updated to construct User with the new params.
46 lines
1.2 KiB
PHP
46 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\User;
|
|
|
|
use DateTimeImmutable;
|
|
use Illuminate\Database\Eloquent\Builder;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
/**
|
|
* @property int $id
|
|
* @property string $email
|
|
* @property string $display_name
|
|
* @property string $password_hash
|
|
* @property bool $is_admin
|
|
* @property ?DateTimeImmutable $email_confirmed_at
|
|
*
|
|
* @method static Builder<static>|UserModel newModelQuery()
|
|
* @method static Builder<static>|UserModel newQuery()
|
|
* @method static Builder<static>|UserModel query()
|
|
* @method static Builder<static>|UserModel whereId($value)
|
|
* @method static Builder<static>|UserModel whereEmail($value)
|
|
* @method static Builder<static>|UserModel whereDisplayName($value)
|
|
* @method static Builder<static>|UserModel whereIsAdmin($value)
|
|
* @method static Builder<static>|UserModel whereEmailConfirmedAt($value)
|
|
*
|
|
* @mixin \Eloquent
|
|
*/
|
|
class UserModel extends Model
|
|
{
|
|
protected $table = 'users';
|
|
|
|
public $timestamps = false;
|
|
|
|
protected $fillable = [
|
|
'email',
|
|
'display_name',
|
|
'password_hash',
|
|
'is_admin',
|
|
'email_confirmed_at',
|
|
];
|
|
|
|
protected $casts = [
|
|
'is_admin' => 'boolean',
|
|
'email_confirmed_at' => 'immutable_datetime',
|
|
];
|
|
}
|