Let us say there are four tables "User" "Location", "Currency", "Account. My question is If you have an 'account' called savings that has a 'location' in a place that uses a different 'currency', but this account is universal so many user can have this account, but all those users can have the account in different currency zones.
How can I write this out in Eloquent?
My thought process in solving this:
- Have a currency foreign key that links to a location table.
- The location table will then link to the users table with a foreign key
- Afterward any account that that user has would be displayed with the locations currency.
Any idea how I could also work it if the user has multiple accounts, but each account could have a different currency?
Thank you in advance.
My eloquent:
$voucher = account::Where('Location','=', Auth::User()-> Location)->where('Currency','=','Dollar')->get();