visuddhinanda@gmail.com 3 лет назад
Родитель
Сommit
23d0ef63df
1 измененных файлов с 13 добавлено и 0 удалено
  1. 13 0
      app/Models/ProgressChapter.php

+ 13 - 0
app/Models/ProgressChapter.php

@@ -8,4 +8,17 @@ use Illuminate\Database\Eloquent\Model;
 class ProgressChapter extends Model
 {
     use HasFactory;
+	protected $fillable = ['book' , 'book', 'channel_id','lang'=>'en',
+                            'all_trans','public','progress',
+                            'title','created_at','updated_at'];
+    protected $primaryKey = 'uid';
+    public function tagid()
+    {
+        return $this->hasOne('App\Models\TagMap', 'anchor_id', 'uid'); //参数一:需要关联的子表类名,前面必须加上命名空间  参数二:子表关联父表的字段  参数三:父表关联子表的字段
+    }
+
+    public function tags()
+    {
+        return $this->belongsToMany('App\Models\Tag','tag_maps','anchor_id','tag_id');
+    }
 }