visuddhinanda 10 месяцев назад
Родитель
Сommit
fca870ca77
1 измененных файлов с 8 добавлено и 1 удалено
  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
 {
     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');
+    }
 }