Sony has released a fix for PS4 that have an issue of ejecting discs. Apparently, the issue is really simple to be fixed as it only requires you removing the power cable and letting the PS4 discharge the current.
Alternatively, you can also press the power switch when the PS4 is plugged out, so that it discharges the current.
Here’s a video from Sony explaining how to fix this issue incase your PS4 keeps ejecting discs. However, if this method does not work, you will have to send the console back to Sony.
Check out the video below.