coolify/app/Models/User.php
peaklabs-dev d0562593d6
chore(auth): improve user model
- use property-read instead of property which prevents property assignment e.g. calling 
  ->save() on a model (Larastan will flag it)
- cast all colums explicitly to avoid wired issues between different DB types
2026-02-24 19:08:16 +01:00

51 lines
1.2 KiB
PHP

<?php
declare(strict_types=1);
namespace App\Models;
use Carbon\CarbonInterface;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
/**
* @property-read int $id
* @property-read string $name
* @property-read string $email
* @property-read CarbonInterface|null $email_verified_at
* @property-read string $password
* @property-read CarbonInterface $created_at
* @property-read CarbonInterface $updated_at
*/
final class User extends Authenticatable
{
/** @use HasFactory<\Database\Factories\UserFactory> */
use HasFactory;
/**
* The attributes that should be hidden for serialization.
*
* @var list<string>
*/
protected $hidden = [
'password',
];
/**
* Get the attributes that should be cast.
*
* @return array<string, string>
*/
protected function casts(): array
{
return [
'id' => 'int',
'name' => 'string',
'email' => 'string',
'email_verified_at' => 'datetime',
'password' => 'hashed',
'created_at' => 'datetime',
'updated_at' => 'datetime',
];
}
}