property id does not exist on this collection instance laravel code example
Example: Property [id] does not exist on this collection instance.
$user = User::where('name', 'like', '%Mat%')->first();
$user->posts->each(function($post) {
echo $post->comment;
});