visuddhinanda 5 mesi fa
parent
commit
4c62ceb001
1 ha cambiato i file con 22 aggiunte e 0 eliminazioni
  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;
+    }
+}