Post here your code.
Help on how to use one Address model multiple times.
Hi, I am learning Laravel as my lockdown project (beginner) and I've become stuck on the best way to proceed with my current build.
At the moment I have a Users database and an Address database so that users can register multiple addresses. It's set up as a polymorphic many to many relationship and this bit all works fine.
Now I would like to add Football Clubs and hold their addresses in the same database but this where I hit my road block. What's the best, easiest way to do this that can also scale up?
So far I have thought of having a separate FootballClubAddressController but I don't know how to do that without repeating a bunch of code I've already used in the AddressController.
Or maybe I should have one AddressController with some sort of if/then clauses peppered throughout? Again I'm not sure how to that without that also becoming messy.
So if someone could point me towards the best way to do this. that'll be much appreciated.
And just so know, I'd like the method to work not just for addresses, but emails and phone numbers, and won't just be Users and Football Clubs, but also Venues and Offices.
Thanks in Advance.
A
Please or to participate in this conversation.