📜  此集合实例上不存在属性 [id]. - 无论代码示例

📅  最后修改于: 2022-03-11 14:55:57.440000             🧑  作者: Mango

代码示例1
$user = User::where('name', 'like', '%Mat%')->first();

$user->posts->each(function($post) {
    echo $post->comment;
});