forge/app/Models/ModResolvedDependency.php
Refringe 1783a683ed
Semvar & Automatic Resolution - Remix
- 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. :(
2024-08-29 15:46:10 -04:00

34 lines
840 B
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
class ModResolvedDependency extends Model
{
/**
* The relationship between the resolved dependency and the mod version.
*/
public function modVersion(): BelongsTo
{
return $this->belongsTo(ModVersion::class, 'mod_version_id');
}
/**
* The relationship between the resolved dependency and the dependency.
*/
public function dependency(): BelongsTo
{
return $this->belongsTo(ModDependency::class);
}
/**
* The relationship between the resolved dependency and the resolved mod version.
*/
public function resolvedModVersion(): BelongsTo
{
return $this->belongsTo(ModVersion::class, 'resolved_mod_version_id');
}
}