extend User entity with displayname and email confirmation
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.
This commit is contained in:
parent
d547ec2c61
commit
298b8634ec
10 changed files with 131 additions and 15 deletions
|
|
@ -2,21 +2,26 @@
|
|||
|
||||
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
|
||||
*/
|
||||
|
|
@ -28,11 +33,14 @@ class UserModel extends Model
|
|||
|
||||
protected $fillable = [
|
||||
'email',
|
||||
'display_name',
|
||||
'password_hash',
|
||||
'is_admin',
|
||||
'email_confirmed_at',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'is_admin' => 'boolean',
|
||||
'email_confirmed_at' => 'immutable_datetime',
|
||||
];
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue