visuddhinanda 3 лет назад
Родитель
Сommit
9987585fb5
1 измененных файлов с 14 добавлено и 0 удалено
  1. 14 0
      app/Http/Api/SuggestionApi.php

+ 14 - 0
app/Http/Api/SuggestionApi.php

@@ -2,6 +2,8 @@
 namespace App\Http\Api;
 
 use App\Models\SentPr;
+use App\Models\Discussion;
+use App\Models\Sentence;
 use App\Http\Api\PaliTextApi;
 
 class SuggestionApi{
@@ -12,6 +14,18 @@ class SuggestionApi{
                                     ->where('word_end',$end)
                                     ->where('channel_uid',$channel)
                                     ->count();
+        $sentId = Sentence::where('book_id',$book)
+                            ->where('paragraph',$para)
+                            ->where('word_start',$start)
+                            ->where('word_end',$end)
+                            ->where('channel_uid',$channel)
+                            ->value('uid');
+        if($sentId){
+            $count['discussion'] = Discussion::where('res_id',$sentId)
+                                            ->whereNull('parent')
+                                            ->count();
+        }
+
         return $count;
     }
 }