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

sork's avatar
Level 1

Database table design

Hello Team,

I have (Ticket, Insurance ...etc) models and each of these models is belongs to customer, supplier and agent. when a ticket is created, the following payment transactions happen:

  1. customer is paying me for the ticket.
  2. supplier paying me commission.
  3. I pay agent commission.

same payment transaction is happening when insurance is created as well.

now I am confused, how to design the payment transaction table?! is a good practice if i create 3 tables (customer_transactions, supplier_transactions and agent_transaction) as per below structure?

customer_transactions

id
transactionable_type 
transactionable_id,
customer_id
.
.
.

where transactionable_type could be Ticket or Insurance.

appreciate if you share another possibilities for above scenario.

0 likes
0 replies

Please or to participate in this conversation.