[eluser]waterloomatt[/eluser]
Hi,
I am writing an app for teachers to post "subbing" positions. Respondents can reply and "bid" on positions. The school can choose a teacher based on various criteria.
One of our business rules is that school cannot "bid" on their owns posts. Another is that respondents can only bid on a particular position once. There are a few other rules that relate directly to the "bidding process".
What is the best/recommended approach to store these business rules? Everyone keeps saying that Models manipulate data, but in the same breath say that business rules are also contained in Models.
If so, would it look like this:
Controller:
Code:
insertBid()
{
if (!$this->bidModel()->validateUserForBid($loggedInUserId))
{
// Set flashdata for errormessage and redirect.
redirect("bid/$postId");
}
}
Or should the controller, helper, or library handle the logic?
Cheers & thanks.