* docs(openspec): propose setup-foundation change Add OpenSpec change for SPEC Phase 0 — Foundation with proposal, design, capability specs, and implementation tasks. Populate openspec/config.yaml with project context and artifact rules. Co-authored-by: Cursor <cursoragent@cursor.com> * feat: bootstrap Laravel 13 foundation (Fase 0) Implement OpenSpec change setup-foundation: Laravel 13 + Filament 5 admin panel, Livewire 4 public site shell, PostgreSQL via Compose, design tokens, role-based auth, quality gates (Pint/Larastan/Pest), FrankenPHP Dockerfile, and GitHub Actions CI with five blocking jobs. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(ci): use valid APP_KEY for encryption in tests Co-authored-by: Cursor <cursoragent@cursor.com> --------- Co-authored-by: Cursor <cursoragent@cursor.com>
51 lines
1.2 KiB
PHP
51 lines
1.2 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Models;
|
|
|
|
use App\Enums\UserRole;
|
|
use Database\Factories\UserFactory;
|
|
use Filament\Models\Contracts\FilamentUser;
|
|
use Filament\Panel;
|
|
use Illuminate\Database\Eloquent\Attributes\Fillable;
|
|
use Illuminate\Database\Eloquent\Attributes\Hidden;
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Foundation\Auth\User as Authenticatable;
|
|
use Illuminate\Notifications\Notifiable;
|
|
|
|
/**
|
|
* @property UserRole $role
|
|
* @property bool $is_active
|
|
*/
|
|
#[Fillable(['name', 'email', 'password', 'role', 'is_active'])]
|
|
#[Hidden(['password', 'remember_token'])]
|
|
class User extends Authenticatable implements FilamentUser
|
|
{
|
|
/** @use HasFactory<UserFactory> */
|
|
use HasFactory, Notifiable;
|
|
|
|
public function canAccessPanel(Panel $panel): bool
|
|
{
|
|
return $this->is_active;
|
|
}
|
|
|
|
public function isAdmin(): bool
|
|
{
|
|
return $this->role === UserRole::Admin;
|
|
}
|
|
|
|
/**
|
|
* @return array<string, string|class-string>
|
|
*/
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'email_verified_at' => 'datetime',
|
|
'password' => 'hashed',
|
|
'role' => UserRole::class,
|
|
'is_active' => 'boolean',
|
|
];
|
|
}
|
|
}
|