id | text
id | content | …
tag_id | content_id
class Content extends Model {
public function tags(): BelongsToMany {
return $this->belongsToMany(Tag::class);
}
}
class Tag extends Model {
public function contents(): BelongsToMany {
return $this->belongsToMany(Content::class);
}
}
dd($content->tags);