|
|
@@ -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;
|
|
|
}
|
|
|
}
|