mirror of
https://github.com/coollabsio/coolify.git
synced 2026-03-11 08:55:47 +00:00
- 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
51 lines
1.2 KiB
PHP
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',
|
|
];
|
|
}
|
|
}
|