mailwolt/app/Models/User.php

42 lines
902 B
PHP

<?php
namespace App\Models;
// use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
class User extends Authenticatable
{
/** @use HasFactory<\Database\Factories\UserFactory> */
use HasFactory, Notifiable;
protected $fillable = [
'name',
'username',
'email',
'password',
'is_active',
'must_change_pw',
'role',
];
protected $hidden = [
'password',
'remember_token',
];
protected $casts = [
'email_verified_at' => 'datetime',
'is_active' => 'boolean',
'must_change_pw' => 'boolean',
];
/** Quick helper: check if user is admin */
public function isAdmin(): bool
{
return $this->role === 'admin';
}
}