tethys/app/Models/Subject.php
Arno Kaimbacher 75b37368e4 - change relation between document and dataset_subjects to M : n:
a. during creating a dataste, also find existing keywords and attach them
b. DatasetExtension.php
c. Subject.php: protected $table = 'dataset_subjects';
d. migration file for crete_dataset_subjects_table
- change api routes for also using url alias if defined
- composer updates: composer.lock
2021-06-07 16:53:45 +02:00

25 lines
582 B
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use App\Models\Dataset;
class Subject extends Model
{
// protected $table = 'document_subjects';
protected $table = 'dataset_subjects';
public $timestamps = false;
protected $fillable = ['value', 'type', 'language'];
// public function dataset()
// {
// return $this->belongsTo(Dataset::class, 'document_id', 'id');
// }
public function datasets()
{
return $this->belongsToMany(Dataset::class, 'link_dataset_subjects', 'subject_id', 'document_id');
}
}