Iro*_*ind 6 laravel eloquent laravel-4
$city = City::with('station')->where('name',$town)->first();
$townID = 1;
$townComments = TownComment::where('town_id',$townID)->get();
$city->town_comments = $townComments;
Run Code Online (Sandbox Code Playgroud)
当我这样做时,结果town_comments只显示boolean了timestamps,incrementing和exists.
我在这做错了什么?
这是它的样子:
{
id: "1",
name: "tokyo",
similar_stations: {
timestamps: false,
incrementing: true,
exists: true
}
}
Run Code Online (Sandbox Code Playgroud)
Bry*_*n P 18
它是这样显示的,因为它$townComments是一个自动编码的对象JSON,我忘记了我读它的参考,但这是解决方案.
$city->town_comments = $townComments->toArray();
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2021 次 |
| 最近记录: |