1
I have a Receivables table that has a relationship with the Customer Table and TWO relationships with a Chart of Accounts table*
I searched the Eloquent documentation but couldn’t find out how to make these two relationships with the same table. For the client table and the first relationship with the Account Plan table is quiet.
A well summarized example of how are my tables
clientes: (id, nome, cpfcnpj)
planocontas: (id, nome, tipo)
recebimentos: (id, data, dtvco, dtpgo, valor, id_cliente, id_planoconta, id_planoconta2);
How to make the hasMany method inside the Model Planoconta so it works for both the id_planoconta and the id_planoconta2 of the Receipts table ?
I thought of creating two new tables, each for a link from the Accounts Receivable table to the Accounts Plan table, using the Many to Many relationship.
id_planoconta
,id_planoconta2
because it has these two fields, what is the reason ?– novic
Ola @Virgilionovic the reason is that these two fields refer to separate accounts in the chart of accounts. In the project I am working it is necessary to classify the account to indicate what it is about (id_planoconta) and classify its receipt (id_planoconta2).
– Christiano Ribeiro Soares