mirror of
https://github.com/sp-tarkov/forge.git
synced 2025-02-12 20:20:41 -05:00
50 lines
1.2 KiB
PHP
50 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace Database\Factories;
|
|
|
|
use App\Models\License;
|
|
use App\Models\Mod;
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
use Illuminate\Support\Str;
|
|
use Random\RandomException;
|
|
|
|
class ModFactory extends Factory
|
|
{
|
|
protected $model = Mod::class;
|
|
|
|
/**
|
|
* @throws RandomException
|
|
*/
|
|
public function definition(): array
|
|
{
|
|
|
|
$name = fake()->catchPhrase();
|
|
|
|
return [
|
|
'name' => $name,
|
|
'slug' => Str::slug($name),
|
|
'teaser' => fake()->sentence(),
|
|
'description' => fake()->paragraphs(random_int(4, 20), true),
|
|
'license_id' => License::factory(),
|
|
'source_code_link' => fake()->url(),
|
|
'featured' => fake()->boolean(),
|
|
'contains_ai_content' => fake()->boolean(),
|
|
'contains_ads' => fake()->boolean(),
|
|
'disabled' => fake()->boolean(),
|
|
'created_at' => now(),
|
|
'updated_at' => now(),
|
|
'published_at' => now()->subHours(3),
|
|
];
|
|
}
|
|
|
|
/**
|
|
* Indicate that the mod should be soft-deleted.
|
|
*/
|
|
public function deleted(): static
|
|
{
|
|
return $this->state(fn (array $attributes) => [
|
|
'deleted_at' => now(),
|
|
]);
|
|
}
|
|
}
|