diff --git a/app/Http/Controllers/WorldController.php b/app/Http/Controllers/WorldController.php
index c1a0ee12f..1d2c08168 100644
--- a/app/Http/Controllers/WorldController.php
+++ b/app/Http/Controllers/WorldController.php
@@ -295,7 +295,7 @@ public function getSubtypeFeatures($id, Request $request) {
} else {
$features = $features
->filter(function ($feature) use ($subtype) {
- return !($feature->subtype && $feature->subtype->id != $subtype->id);
+ return !($feature->subtypd_ids && !in_array($subtype->id, $feature->subtype_ids));
})
->groupBy(['feature_category_id', 'id']);
}
diff --git a/app/Models/Species/Species.php b/app/Models/Species/Species.php
index 5656e890e..16ce8e923 100644
--- a/app/Models/Species/Species.php
+++ b/app/Models/Species/Species.php
@@ -176,7 +176,7 @@ public function getSearchUrlAttribute() {
* @return string
*/
public function getVisualTraitsUrlAttribute() {
- return url('/world/species/'.$this->id.'/traits');
+ return url('world/species/'.$this->id.'/traits');
}
/**
diff --git a/app/Models/Species/Subtype.php b/app/Models/Species/Subtype.php
index 2c64599e6..c7bb9551b 100644
--- a/app/Models/Species/Subtype.php
+++ b/app/Models/Species/Subtype.php
@@ -67,13 +67,6 @@ public function species() {
return $this->belongsTo(Species::class, 'species_id');
}
- /**
- * Get the features associated with this subtype.
- */
- public function features() {
- return $this->hasMany(Feature::class);
- }
-
/**********************************************************************************************
SCOPES
@@ -184,7 +177,7 @@ public function getSearchUrlAttribute() {
* @return string
*/
public function getVisualTraitsUrlAttribute() {
- return url('/world/subtypes/'.$this->id.'/traits');
+ return url('world/subtypes/'.$this->id.'/traits');
}
/**
@@ -204,4 +197,19 @@ public function getAdminUrlAttribute() {
public function getAdminPowerAttribute() {
return 'edit_data';
}
+
+ /**********************************************************************************************
+
+ OTHER FUNCTIONS
+
+ **********************************************************************************************/
+
+ /**
+ * Get the features associated with this subtype.
+ */
+ public function features() {
+ return Feature::all()->filter(function ($feature) {
+ return in_array($this->id, $feature->subtypes_ids ?? []);
+ });
+ }
}
diff --git a/resources/views/world/_subtype_entry.blade.php b/resources/views/world/_subtype_entry.blade.php
index 7e7b8ee8e..ae15dceb5 100644
--- a/resources/views/world/_subtype_entry.blade.php
+++ b/resources/views/world/_subtype_entry.blade.php
@@ -17,7 +17,7 @@
- @if (count($subtype->features) && config('lorekeeper.extensions.visual_trait_index.enable_subtype_index'))
+ @if (count($subtype->features()) && config('lorekeeper.extensions.visual_trait_index.enable_subtype_index'))
Visual Trait Index