scaffold-factory
3
总安装量
3
周安装量
#55774
全站排名
安装命令
npx skills add https://github.com/iurygdeoliveira/labsis-kit --skill scaffold-factory
Agent 安装分布
claude-code
2
windsurf
1
trae
1
opencode
1
codex
1
antigravity
1
Skill 文档
Laravel Factory Scaffold Skill
Use this skill when defining test data generators for Models.
Conventions
1. Sensible Faker Data
- Use
$this->fakermethods that match the column type contextually. - Email:
safeEmail()(never real emails). - Text:
paragraph()orsentence()depending on length. - Enums:
fake()->randomElement(Enum::cases()).
2. State Methods
- Create state methods for every boolean flag or status enum in the model.
- This makes tests readable:
User::factory()->active()->admin()->create().
public function admin(): static
{
return $this->state(fn (array $attributes) => [
'role' => UserRole::Admin,
]);
}
public function suspended(): static
{
return $this->state(fn (array $attributes) => [
'suspended_at' => now(),
]);
}
3. Relationships
- For “BelongsTo” relationships, create the parent factory by default in the definition.
'user_id' => User::factory(),