mirror of
https://github.com/sp-tarkov/forge.git
synced 2025-02-12 20:20:41 -05:00
- Handles circular mod version dependencies - Optimizes mod show query to only pull the versions relationship - Adds a mod dependency factory - Refactored tests to use mod dependency factory - Adds mod dependency generation into the default seeder - Adds unique index on mod dependencies table - Adds mod dependencies on the mod show view
26 lines
729 B
PHP
26 lines
729 B
PHP
<?php
|
|
|
|
namespace Database\Factories;
|
|
|
|
use App\Models\Mod;
|
|
use App\Models\ModDependency;
|
|
use App\Models\ModVersion;
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
use Illuminate\Support\Carbon;
|
|
|
|
class ModDependencyFactory extends Factory
|
|
{
|
|
protected $model = ModDependency::class;
|
|
|
|
public function definition(): array
|
|
{
|
|
return [
|
|
'mod_version_id' => ModVersion::factory(),
|
|
'dependency_mod_id' => Mod::factory(),
|
|
'version_constraint' => '^'.$this->faker->numerify('#.#.#'),
|
|
'created_at' => Carbon::now()->subDays(rand(0, 365))->subHours(rand(0, 23)),
|
|
'updated_at' => Carbon::now()->subDays(rand(0, 365))->subHours(rand(0, 23)),
|
|
];
|
|
}
|
|
}
|