瀏覽代碼

add paliText

visuddhinanda 3 天之前
父節點
當前提交
e53d1b3429
共有 1 個文件被更改,包括 8 次插入2 次删除
  1. 8 2
      api-v12/app/Models/ProgressChapter.php

+ 8 - 2
api-v12/app/Models/ProgressChapter.php

@@ -10,10 +10,9 @@ class ProgressChapter extends Model
 {
     use HasFactory;
     protected $fillable = [
-        'book',
         'book',
         'channel_id',
-        'lang' => 'en',
+        'lang',
         'all_trans',
         'public',
         'progress',
@@ -51,6 +50,13 @@ class ProgressChapter extends Model
     {
         return $this->hasOne(Channel::class, 'uid', 'channel_id');
     }
+
+    public function paliText()
+    {
+        return $this->hasOne(PaliText::class, 'book', 'book')
+            ->whereColumn('paragraph', 'progress_chapters.para');
+    }
+
     public function views()
     {
         return $this->hasMany('App\Models\View', 'target_id', 'uid');