Foreign Keys in Laravel
A handy way to remember…
Full disclosure: this was created by ‘Snapey’ on the Laracasts forum. I thought it was useful and put it on my blog to make it easy for me and others to find.
A lot of people, including me, become very confused when it comes to remembering how to structure eloquent relationships and which relationship gets a foreign key (if at all).
The table below is an easy summary of how it works and is useful for a quick jog of the memory: