我有一个多对多关联
articles *---* categories via article_categories
这就是 article_categories 的样子 id article_id category_id
现在,我在 article_categories 中添加了另一个名为“score”的列
id
article_id
category_id
score
这是我写出类别的方式
foreach ($article->categories as $c) {
echo $c->title
}
我想在类别标题旁边输出 article_category 分数。我怎么做?
但我还需要输出分数和标题
foreach ($article->categories as $c) {
echo $c->title
echo $c-> ? # how do I do this here?
}