51 lines
1.6 KiB
PHP
51 lines
1.6 KiB
PHP
<?php
|
|
|
|
namespace Database\Factories;
|
|
|
|
use App\Models\Skill;
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
use Illuminate\Support\Str;
|
|
|
|
/**
|
|
* @extends Factory<Skill>
|
|
*/
|
|
class SkillFactory extends Factory
|
|
{
|
|
/**
|
|
* @return array<string, mixed>
|
|
*/
|
|
public function definition(): array
|
|
{
|
|
$name = fake()->unique()->company().' Skill';
|
|
$categories = array_keys(config('skills.categories'));
|
|
|
|
return [
|
|
'name' => $name,
|
|
'slug' => Str::slug($name),
|
|
'description' => fake()->paragraph(),
|
|
'url' => fake()->url(),
|
|
'docs_url' => fake()->url(),
|
|
'logo_url' => 'https://picsum.photos/seed/'.Str::slug($name).'/200',
|
|
'category' => fake()->randomElement($categories),
|
|
'install_instructions' => 'Copy this skill folder into ~/.claude/skills/ (or add it via a plugin marketplace) and restart Claude.',
|
|
'example_prompt' => fake()->sentence(),
|
|
'requirements' => fake()->randomElement(['Claude Code', 'Claude with Code Execution tool', null]),
|
|
'tags' => fake()->randomElements(['official', 'community', 'anthropic', 'automation'], rand(1, 3)),
|
|
'views' => fake()->numberBetween(0, 5000),
|
|
'clicks' => fake()->numberBetween(0, 500),
|
|
'featured' => false,
|
|
'approved' => true,
|
|
];
|
|
}
|
|
|
|
public function featured(): static
|
|
{
|
|
return $this->state(fn () => ['featured' => true]);
|
|
}
|
|
|
|
public function pending(): static
|
|
{
|
|
return $this->state(fn () => ['approved' => false]);
|
|
}
|
|
}
|