It cannot.
Heller:
3.
The handgun ban and the trigger-lock requirement (as applied to self-defense) violate the Second Amendment . The District’s total ban on handgun possession in the home amounts to a prohibition on an entire class of “arms” that Americans overwhelmingly choose for the lawful purpose of self-defense.
Under any of the standards of scrutiny the Court has applied to enumerated constitutional rights, this prohibition—in the place where the importance of the lawful defense of self, family, and property is most acute—
would fail constitutional muster. Similarly, the requirement that any lawful firearm in the home be disassembled or bound by a trigger lock makes it impossible for citizens to use arms for the core lawful purpose of self-defense and is hence unconstitutional
The legal requirement to secure your firearms fails constitutional muster, under any standard of scrutiny.
The text of the ruling does not allow for an exception for children in the house, and in any case, the court, in
Bruen , threw out any argument regarding means-end scrutiny with regard to the right to keep an bear arms.