diff --git a/api/app/Http/Controllers/TaxonomyController.php b/api/app/Http/Controllers/TaxonomyController.php index 6556c9b8f2..be45749c0a 100644 --- a/api/app/Http/Controllers/TaxonomyController.php +++ b/api/app/Http/Controllers/TaxonomyController.php @@ -228,6 +228,8 @@ public function showOneTaxon($id, Request $request){ $parStatusResult = $parStatus->get(); $taxonObj->classification = $parStatusResult; + $taxonObj->taxonCodes; + if(!$taxonObj->count()) $taxonObj = ['status' =>false, 'error' => 'Unable to locate inventory based on identifier']; return response()->json($taxonObj); } diff --git a/api/app/Models/NeonTaxonomy.php b/api/app/Models/NeonTaxonomy.php new file mode 100644 index 0000000000..188871e97c --- /dev/null +++ b/api/app/Models/NeonTaxonomy.php @@ -0,0 +1,27 @@ +belongsTo(Taxonomy::class, 'tid', 'tid'); + } +} diff --git a/api/app/Models/Taxonomy.php b/api/app/Models/Taxonomy.php index f743e6d7d2..8ee7857d88 100644 --- a/api/app/Models/Taxonomy.php +++ b/api/app/Models/Taxonomy.php @@ -23,4 +23,8 @@ public function descriptions(){ public function media(){ return $this->hasMany(media::class, 'tid', 'tid'); } + + public function taxonCodes(){ + return $this->hasMany(NeonTaxonomy::class, 'tid', 'tid'); + } }