Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Crazylife's avatar

database design on relationship between account, company and department

I have 3 entity, account, company and department.

1 account can handle multiple company with multiple department. 1 account can bind to multiple department. 1 company can handle multiple department. 1 department can be assigned to multiple company and multiple account.

My idea looks like this

account -> account_department <- department
account -> account_companies <- companies
companies-> company_department <- department

Is there any issue as it looks like circular or enhancement can be made?

0 likes
1 reply
jlrdw's avatar

I have mostly done is accounting and bookkeeping applications and one Logistics application that included accounts payable accounts receivable driver payroll etc.

Just set up your chart of accounts. See https://laracasts.com/discuss/channels/general-discussion/rental-management-db-schema

And a decent visual query designer.

I would not use active record for those areas where eventually you could have tens of thousands of records that has to reflect in a monthly report.

I would use straight PDO with getPdo () for any complex monthly reports.

You could even Implement Jasper reports, but that's up to you.

Also my advice would be if you've never done any bookkeeping yourself hire a consultant to assist you writing such an application.

Or take some bookkeeping courses.

Please or to participate in this conversation.