Laravel 4 - 雄辩的结果仅在另一个对象内部分配时显示(时间戳、递增、存在)


$city = City::with('station')->where('name',$town)->first();
$townID = 1;
$townComments = TownComment::where('town_id',$townID)->get();
$city->town_comments = $townComments;

当我这样做时,town_comments的结果仅显示timestampsincrementingexistsboolean

我在这里做错了什么?

下面是它的外观:

{
id: "1",
name: "tokyo",
similar_stations: {
    timestamps: false,
    incrementing: true,
    exists: true
}
}

之所以这样显示$townComments是因为它是一个自动编码为JSON的对象,我忘记了阅读它的参考,但这是解决方案。

$city->town_comments = $townComments->toArray();

最新更新