mirror of
https://github.com/sp-tarkov/forge.git
synced 2025-02-13 04:30:41 -05:00
Refringe
1783a683ed
- Updated the SptVersion and ModVersion dependancies to resolve *all* compatible versions and introduced new relationships to pull just the latest compatible version. Had to rewrite a *bunch*, but it should be much more capable now. It can be expensive to resolve these properties when iterated over, so *make sure they're eager loaded using the `with` method when you're building the queries*. - Updated the mod listing Livewire component to save the filter options within the PHP session instead of in browser local storage. *Much* cleaner. - Removed caching from homepage queries to see how they preform on production. Will add back later. - Updated ModVersion factory to create SptVersions if there are none specified. - Probably lots of other changes too... I need to make smaller commits. :(
45 lines
1.1 KiB
PHP
45 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
|
|
|
/**
|
|
* @property int $id
|
|
* @property int $mod_version_id
|
|
* @property int $dependency_mod_id
|
|
* @property string $constraint
|
|
* @property int|null $resolved_version_id
|
|
*/
|
|
class ModDependency extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
/**
|
|
* The relationship between the mod dependency and the mod version.
|
|
*/
|
|
public function modVersion(): BelongsTo
|
|
{
|
|
return $this->belongsTo(ModVersion::class);
|
|
}
|
|
|
|
/**
|
|
* The relationship between the mod dependency and the resolved dependency.
|
|
*/
|
|
public function resolvedDependencies(): HasMany
|
|
{
|
|
return $this->hasMany(ModResolvedDependency::class, 'dependency_id');
|
|
}
|
|
|
|
/**
|
|
* The relationship between the mod dependency and the dependent mod.
|
|
*/
|
|
public function dependentMod(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Mod::class, 'dependent_mod_id');
|
|
}
|
|
}
|