visuddhinanda hace 4 meses
padre
commit
4c62ceb001
Se han modificado 1 ficheros con 22 adiciones y 0 borrados
  1. 22 0
      api-v8/app/Services/TagService.php

+ 22 - 0
api-v8/app/Services/TagService.php

@@ -0,0 +1,22 @@
+<?php
+
+namespace App\Services;
+
+use App\Models\TagMap;
+
+class TagService
+{
+    public function getTagsName(string $resId)
+    {
+        $tagsName = TagMap::where('table_name', 'pali_texts')
+            ->where('anchor_id', $resId)
+            ->join('tags', 'tag_maps.tag_id', '=', 'tags.id')
+            ->select('tags.name')
+            ->get();
+        $output = [];
+        foreach ($tagsName as $key => $value) {
+            $output[] = $value->name;
+        }
+        return $output;
+    }
+}