Reputation: 271
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
array('mobile','length', 'max'=>14 ,'min'=>3),
Thanks in advance
Upvotes: 0
Views: 69
Reputation: 133
echo (if(isset(admin_session))) ? 'write the update code for admin' : 'write the normal user update code';
Upvotes: 1