The commander of the guards trusted Joseph with everything that was in the prison. This happened because the Lord was with Joseph. The Lord helped Joseph be successful in everything he did.
So Potiphar was very happy for Joseph. Potiphar allowed Joseph to work for him and help him to rule the house. Joseph was the ruler over everything Potiphar owned.