2024-05-15 00:31:24 -04:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Database\Factories;
|
|
|
|
|
|
|
|
use App\Models\License;
|
|
|
|
use App\Models\Mod;
|
|
|
|
use App\Models\User;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
|
|
use Illuminate\Support\Str;
|
|
|
|
|
|
|
|
class ModFactory extends Factory
|
|
|
|
{
|
|
|
|
protected $model = Mod::class;
|
|
|
|
|
|
|
|
public function definition(): array
|
|
|
|
{
|
|
|
|
$name = $this->faker->words(3, true);
|
|
|
|
|
|
|
|
return [
|
|
|
|
'user_id' => User::factory(),
|
|
|
|
'name' => $name,
|
|
|
|
'slug' => Str::slug($name),
|
2024-05-21 21:02:49 -04:00
|
|
|
'teaser' => $this->faker->sentence,
|
|
|
|
'description' => $this->faker->sentences(6, true),
|
2024-05-15 00:31:24 -04:00
|
|
|
'license_id' => License::factory(),
|
|
|
|
'source_code_link' => $this->faker->url(),
|
2024-05-21 21:02:49 -04:00
|
|
|
'featured' => $this->faker->boolean,
|
2024-05-15 00:31:24 -04:00
|
|
|
'contains_ai_content' => $this->faker->boolean,
|
2024-05-31 17:44:52 -04:00
|
|
|
'contains_ads' => $this->faker->boolean,
|
|
|
|
'disabled' => $this->faker->boolean,
|
2024-05-15 00:31:24 -04:00
|
|
|
'created_at' => now(),
|
|
|
|
'updated_at' => now(),
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Indicate that the mod should be soft-deleted.
|
|
|
|
*/
|
|
|
|
public function deleted(): static
|
|
|
|
{
|
|
|
|
return $this->state(fn (array $attributes) => [
|
|
|
|
'deleted_at' => now(),
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
}
|