Pharaoh had a dream that could not be interpreted, then his butler remembered Joseph. Joseph interpreted the dream and as a result was given charge of all of Egypt. He then was restored not only in Egypt but his family was restored to him as well.
Source:
Genesis 37-47