| Server IP : 35.80.110.71 / Your IP : 216.73.216.21 Web Server : Apache/2.4.58 (Ubuntu) System : Linux ip-172-31-21-44 6.17.0-1019-aws #19~24.04.1-Ubuntu SMP Tue Jun 23 18:53:06 UTC 2026 x86_64 User : ubuntu ( 1000) PHP Version : 8.3.31 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /var/www/codex/current/database/factories/ |
Upload File : |
<?php
namespace Database\Factories;
use App\Models\Package;
use Illuminate\Database\Eloquent\Factories\Factory;
/** @extends Factory<Package> */
class PackageFactory extends Factory
{
public function definition(): array
{
$slug = fake()->unique()->slug(3).'-'.fake()->unique()->numerify('####');
$language = fake()->randomElement(['typescript', 'php', 'python', 'go', 'rust', 'ruby']);
$registry = match ($language) {
'typescript' => 'npm',
'php' => 'packagist',
'python' => 'pypi',
'go' => 'go',
'rust' => 'cargo',
'ruby' => 'rubygems',
default => 'npm',
};
return [
'slug' => $slug,
'name' => ucfirst(str_replace('-', ' ', $slug)),
'language' => $language,
'registry' => $registry,
'status' => 'active',
'short_description' => fake()->sentence(),
'long_description' => fake()->paragraph(),
'long_description_reviewed' => true,
'repo_url' => 'https://github.com/philiprehberger/'.$slug,
'registry_url' => null,
'docs_url' => null,
'shipped_date' => fake()->dateTimeBetween('-2 years', 'now')->format('Y-m-d'),
];
}
public function archived(): static
{
return $this->state(['status' => 'archived']);
}
}