belongsTo(Dataset::class, 'document_id', 'id'); // } public function datasets() { return $this->belongsToMany(Dataset::class, 'link_dataset_subjects', 'subject_id', 'document_id'); } }