2024-07-26 02:19:42 -04:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Models;
|
|
|
|
|
2024-08-01 17:15:02 -04:00
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
2024-07-26 02:19:42 -04:00
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
2024-08-29 15:46:10 -04:00
|
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
2024-07-26 02:19:42 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @property int $id
|
|
|
|
* @property int $mod_version_id
|
|
|
|
* @property int $dependency_mod_id
|
2024-08-29 15:46:10 -04:00
|
|
|
* @property string $constraint
|
2024-07-26 02:19:42 -04:00
|
|
|
* @property int|null $resolved_version_id
|
|
|
|
*/
|
|
|
|
class ModDependency extends Model
|
|
|
|
{
|
2024-08-01 17:15:02 -04:00
|
|
|
use HasFactory;
|
|
|
|
|
2024-07-26 02:19:42 -04:00
|
|
|
/**
|
2024-08-29 15:46:10 -04:00
|
|
|
* The relationship between the mod dependency and the mod version.
|
2024-07-26 02:19:42 -04:00
|
|
|
*/
|
|
|
|
public function modVersion(): BelongsTo
|
|
|
|
{
|
|
|
|
return $this->belongsTo(ModVersion::class);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2024-08-29 15:46:10 -04:00
|
|
|
* The relationship between the mod dependency and the resolved dependency.
|
2024-07-26 02:19:42 -04:00
|
|
|
*/
|
2024-08-29 15:46:10 -04:00
|
|
|
public function resolvedDependencies(): HasMany
|
2024-07-26 02:19:42 -04:00
|
|
|
{
|
2024-08-29 15:46:10 -04:00
|
|
|
return $this->hasMany(ModResolvedDependency::class, 'dependency_id');
|
2024-07-26 02:19:42 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2024-08-29 15:46:10 -04:00
|
|
|
* The relationship between the mod dependency and the dependent mod.
|
2024-07-26 02:19:42 -04:00
|
|
|
*/
|
2024-08-29 15:46:10 -04:00
|
|
|
public function dependentMod(): BelongsTo
|
2024-07-26 02:19:42 -04:00
|
|
|
{
|
2024-08-29 15:46:10 -04:00
|
|
|
return $this->belongsTo(Mod::class, 'dependent_mod_id');
|
2024-07-26 02:19:42 -04:00
|
|
|
}
|
|
|
|
}
|