Use Conditional Statements In Model

Is it possible to add conditional statements in Yii model

for eaxmple :

in users model I need to check if user is admin then in update information Controller mobile number field will display as required filed , but if user is normal user change field properties to empty or not required

Thanks in advance

I would use scenario’s (=> Understanding Scenarios) in your situation.

Set the scenario depending on the user role (normal/admin).

Thanks KokoMo ::)

[b]

[/b]

This post helped me , check it on

http://www.yiiframework.com/forum/index.php/topic/7085-what-is-a-scenario-and-safe-attributes/