We know that Joshua knew the nation's weaknesses. We know he reminded them to follow the Law of Moses. He reminded them about keeping the line pure. Joshua was dying. He called the leaders of the nation together to give them their final instructions and encourage them to follow God's commands.
There are countless stories throughout the Bible to show that Israel had to suffer because they failed to follow God's commands. God was loving and patient with Israel, just as He is with us today. We shouldn't confuse patience with approval. Not all things are what they seem to be.
When we pray, demanding our way (as opposed to God's way), we may just get what we've asked for, along with all it's consequences. This is where praying for God's will (not what we want or what we think we want) comes into the picture. Praise and thanksgiving for all the things we have and for the things we don't lets Him know that we are doing our best to be obedient (although we will never be perfect).
Our Heavenly Father will give us all we need. He's promised that. He will take care of us until He calls us home. Pray often. Thank Him everyday. Shout Hallelujah every chance you get. Give Him the praise He deserves and He will bless you!