To unlock the All Nighter trophy in The Sims 4, you will need to make sure one of your Sims stays awake for 24 Sim hours (in-game hours).
To do this, make sure you provide your Sim with a toilet, shower, fridge, cooker and most importantly a coffee machine. A full day will take around 5 minutes on quick speed. If you don't provide your Sim with a coffee machine, they will fall asleep after around 23 hours.
You can do this trophy easily if you setup a new game.