Here "hearts" is a metonym for a person's inner being. The phrase "put my laws in their hearts" is a metaphor for enabling people to know his laws. Alternate translation: "I will enable them to know my laws" (See: [[rc://en/ta/man/translate/figs-metonymy]] and [[rc://en/ta/man/translate/figs-metaphor]])
The phrase "write them on their minds" is a metaphor for causing people to remember his laws. Alternate translation: "I will cause them to remember my laws" (See: [[rc://en/ta/man/translate/figs-metaphor]])