It used to be that you could train on your own gyms by attacking them, then once you got the points high enough from doing that, you could put a Pokèmon of your own in it. Obviously this mechanic has changed, but I can't figure out what it's been replaced with. The only thing I can figure out how to do is feed berries to any demotivated Pokèmon, but there's no indication that doing so opens up new slots. The little tutorial you can view when at a gym doesn't mention how to do it either.
How do I open up a slot to put my Pokèmon in a gym? (Or are the slots always open, and all the gyms I see just happen to be full?)