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

alex_hill's avatar

Model Structure for financial data

I am looking at building a simple app where I have a list of cost centres and three metrics per month (Budget, Actuals, Forecast).

I have a model for the CostCentre, but I was wondering what the best way of structuring the financial data would be.

My current thinking is to have a FinancialPeriod model and three pivot tables (Actuals, Budget, Forecast). My other thinking is to have three different models (Actual, Budget, Forecast) with a BelongsTo Cost Centre relationship.

Any advice on which one makes more sense would be appreciated.

Note: sales etc are stored in a different system and will be manually typed into my system, so a Sale model which rolls up into Actuals is not possible.

0 likes
2 replies
martinbean's avatar

@alex_hill I’m not sure what it is you’re wanting to display from your description as I’m not that familiar with cost centres, but I don’t think you want to be storing periods in your database as that’s going to make it hard to query—you’re going to be restricted to the periods you’ve defined instead of letting users be able to query arbitrary periods they want.

alex_hill's avatar

Think of a cost centre as a shop. A company may have 5 shops, and being able to compare sales between them would be useful. In my scenario each shop will have a sales target for each month, the actual sales for that month and the forecast sales for the next couple of months.

Would you recommend models for the actual, forecast and targets with the date stored on the pivot (allowing for Suffern date periods if required)

Please or to participate in this conversation.