It is a commonly written principle in the scriptures that obeying the commandments leads to prosperity:
“Wherefore ye shall do my statutes, and keep my judgments, and do them; and ye shall dwell in the land in safety.
And the land shall yield her fruit, and ye shall eat your fill, and dwell therein in safety.” (Leviticus 25:18-19)
“Blessed is the man that walketh not in the counsel of the ungodly, nor standeth in the way of sinners, nor sitteth in the seat of the scornful.
But his delight is in the law of the Lord; and in his law doth he meditate day and night.
And he shall be like a tree planted by the rivers of water, that bringeth forth his fruit in his season; his leaf also shall not wither; and whatsoever he doeth shall prosper.
The ungodly are not so: but are like the chaff which the wind driveth away.
Therefore the ungodly shall not stand in the judgment, nor sinners in the congregation of the righteous.
For the Lord knoweth the way of the righteous: but the way of the ungodly shall perish.” (Psalms 1:1-6)
“Blessed art thou and thy children; and they shall be blessed, inasmuch as they shall keep my commandments they shall prosper in the land. But remember, inasmuch as they will not keep my commandments they shall be cut off from the presence of the Lord.” (Alma 50:20)
“And those who were faithful in keeping the commandments of the Lord were delivered at all times, whilst thousands of their wicked brethren have been consigned to bondage, or to perish by the sword, or to dwindle in unbelief” (Alma 50:22)
“there never was a happier time” (Alma 50:23)
This is what I previously wrote after reading Alma 50: Experiencing Happiness