Files
amare/database/factories/UserFactory.php
Manoel Freitas 236a7d3ea9 feat: Fase 0 — Fundação (setup-foundation) (#1)
* 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>
2026-07-27 22:05:25 -03:00

64 lines
1.4 KiB
PHP

<?php
declare(strict_types=1);
namespace Database\Factories;
use App\Enums\UserRole;
use App\Models\User;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Str;
/**
* @extends Factory<User>
*/
class UserFactory extends Factory
{
protected static ?string $password;
/**
* @return array<string, mixed>
*/
public function definition(): array
{
return [
'name' => fake()->name(),
'email' => fake()->unique()->safeEmail(),
'email_verified_at' => now(),
'password' => static::$password ??= Hash::make('password'),
'remember_token' => Str::random(10),
'role' => UserRole::Assistant,
'is_active' => true,
];
}
public function admin(): static
{
return $this->state(fn (array $attributes): array => [
'role' => UserRole::Admin,
]);
}
public function assistant(): static
{
return $this->state(fn (array $attributes): array => [
'role' => UserRole::Assistant,
]);
}
public function inactive(): static
{
return $this->state(fn (array $attributes): array => [
'is_active' => false,
]);
}
public function unverified(): static
{
return $this->state(fn (array $attributes): array => [
'email_verified_at' => null,
]);
}
}