PromptVault/database/factories/PromptFactory.php

36 lines
820 B
PHP
Raw Permalink Normal View History

2026-10-26 20:12:16 +00:00
<?php
namespace Database\Factories;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends Factory<\App\Models\Prompt>
*/
class PromptFactory extends Factory
{
protected $model = \App\Models\Prompt::class;
public function definition(): array
{
return [
'name' => fake()->unique()->sentence(3),
'description' => fake()->sentence(),
'body' => 'Summarize the following text in three bullet points: {{content}}',
'is_favorite' => false,
'usage_count' => 0,
'last_used_at' => null,
];
}
public function favorite(): static
{
return $this->state(['is_favorite' => true]);
}
public function body(string $body): static
{
return $this->state(['body' => $body]);
}
}