[eluser]Shaun Andrews[/eluser]
Hi All,
I'm working on an app for creating and tracking simple financial budgets. I have a database table named Budgets, which contains the fields: id, name, monthly_amount, created_at, and updated_at.
Users enter their expenses (tracked in a separate table) and can see how their spend habits are lining up with their set monthly budgets. Each month (4 weeks, 28 days) their budget is "reset." In reality, I'm calculating their budget based on a 4 week cycle, and only include expenses that exist within the current cycle. Hopeful that's not too confusing, but I don't think its too important for my question:
I want my Budgets model to hold information that doesn't exist within the database. For instance, I want to be able to store the current cycle's spent amount, remaining amount, and status (under, at, or over budget) within each instance of the Budgets object. This information is not something I want (or should) store in the database, as its constantly changing and is based on a number of outside variables (i.e. expenses, date, cycle).
How do I create "virtual" fields for my Budgets model?
Hopefully that all makes sense; I've only been at this whole MVC thing for a few months.
Any help would be greatly appreciated! Thanks!