While a lot of guides elsewhere claim this can be done quickly by.
"Having Codsworth as a companion, modding a weapon and armour at a workbench, saving, reloading that save and then modding the weapon and armour again."
It appears this was patched out in the May 2016 update as a lot of new players are posting elsewhere that the Mod>Save>Reload method isn't working.
Here is a video of it NOT working for me.
I did manage to find another slightly slower way that worked and got me the trophy however.
This involves placing a Weapon and an Armour workbench next to each other along with a bed.
Sleep for 48 hours (2 sets of 24 hours) on the bed, mod one weapon and one piece of armour and then sleep for another 48 hours. You can now mod the same piece of armour and weapon by just switching whatever part you modified back to its original mod rather that creating a new mod and you will receive two more "Codsworth loved that" messages.
Keep doing this Sleep 48 hours > Mod Weapon and Armour >
cycle.(id listen to some music or a podcast while doing it so you don't get to bored at how tedious this is)
After a while it may appear to have stopped working but its actually because Codsworth wants to start a conversation with you, talk positively to him when he does.
Now back to the mod/sleep cycle
Continue this until a message says "Codsworth Idolizes You" which will start another conversation.
When the conversation is finished the trophy will pop
While i never timed it it took me around 30 minutes to get Codsworth to idolize me but that was without me using him as a companion at all up until that point.
Here's 1 cycle of the 48 hour sleep method working.