45 lines
1.1 KiB
PHP
45 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Database\Factories\ProjectFactory;
|
|
use Illuminate\Database\Eloquent\Concerns\HasUuids;
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
use Illuminate\Support\Str;
|
|
|
|
/** @property string $id */
|
|
class Project extends Model
|
|
{
|
|
/** @use HasFactory<ProjectFactory> */
|
|
use HasFactory;
|
|
|
|
use HasUuids, SoftDeletes;
|
|
|
|
protected $table = 'projects';
|
|
|
|
protected $guarded = ['id'];
|
|
|
|
public function newUniqueId(): string
|
|
{
|
|
// Keep application-generated identifiers aligned with gen_random_uuid().
|
|
return (string) Str::uuid();
|
|
}
|
|
|
|
/** @return array<string, string> */
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'version_no' => 'integer',
|
|
'created_at' => 'immutable_datetime',
|
|
'updated_at' => 'immutable_datetime',
|
|
'deleted_at' => 'immutable_datetime',
|
|
'budget_amount' => 'decimal:2',
|
|
'metadata' => 'array',
|
|
'start_date' => 'immutable_date',
|
|
'end_date' => 'immutable_date',
|
|
];
|
|
}
|
|
}
|