2024-07-26 02:19:42 -04:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Models;
|
|
|
|
|
2024-09-12 13:19:52 -04:00
|
|
|
use Database\Factories\ModDependencyFactory;
|
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
|
|
|
|
|
|
|
class ModDependency extends Model
|
|
|
|
{
|
2024-09-12 13:19:52 -04:00
|
|
|
/** @use HasFactory<ModDependencyFactory> */
|
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-09-12 13:19:52 -04:00
|
|
|
*
|
|
|
|
* @return BelongsTo<ModVersion, ModDependency>
|
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-09-12 13:19:52 -04:00
|
|
|
*
|
|
|
|
* @return HasMany<ModResolvedDependency>
|
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-09-11 15:09:27 -04:00
|
|
|
return $this->hasMany(ModResolvedDependency::class, 'dependency_id')
|
|
|
|
->chaperone();
|
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-09-12 13:19:52 -04:00
|
|
|
*
|
|
|
|
* @return BelongsTo<Mod, ModDependency>
|
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
|
|
|
}
|
|
|
|
}
|