Browse Source

add progressChapters

visuddhinanda 10 tháng trước cách đây
mục cha
commit
fca870ca77
1 tập tin đã thay đổi với 8 bổ sung1 xóa
  1. 8 1
      api-v8/app/Models/PaliText.php

+ 8 - 1
api-v8/app/Models/PaliText.php

@@ -8,5 +8,12 @@ use Illuminate\Database\Eloquent\Model;
 class PaliText extends Model
 class PaliText extends Model
 {
 {
     use HasFactory;
     use HasFactory;
-	protected $fillable = ['book','paragraph','level','class','toc','text','html','lenght'];
+    protected $fillable = ['book', 'paragraph', 'level', 'class', 'toc', 'text', 'html', 'lenght'];
+
+    public function progressChapters()
+    {
+        return $this->hasMany(ProgressChapter::class, null, null)
+            ->whereColumn('progress_chapters.book', 'pali_texts.book')
+            ->whereColumn('progress_chapters.para', 'pali_texts.paragraph');
+    }
 }
 }