Currently i have a pretty big project, where i need to store different data for different type of users.
I need to store body details for models.
The problem what i am stuck with is that, female will have different body information than male, and agencies, photographers dont need body information, and the users are in groups
group 3 - Model
group 4 - Agency
group 5 - photographer
In my views i am currently doing this
if ($group == 3 && $gender == 2)
{
// load female body information (lot of details)
}
elseif ($group == 3 && $gender == 1)
{
// load male body information (lot of details)
}
else
{
// load just work explerience & company info
}
Is store the users information broken in 3 tables
users . login information
users_details - users details, like first last name gender ect
users_body - Body information for models both female / male
So why i am asking for a hint for a more effective way because i will need this type of information shown on 3 different pages, and i think it will get messy and will result lot of code duplications
If someone could give me a hint on any advice would be happy
thank you
Handle this logic outside the view and have the result of the logic set a variable for the view with the appropriate result. As for avoiding the 'if-tree' the strategy pattern may come in useful depending on the situation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With