i have frontend and backend,the backend is a module named ‘admin’.
frontend and backend use one model together.
the modle location at protected\models\
how should i know is frontend or backend in the model?
i have one modle,there has a status
field, the value is 1 or 0,on frontend i need to show status = 1,but backend i need to show all data.
so in the model,i define the function relations(),like this:
public function relations()
{
return array(
'questions' => array(self::HAS_MANY, 'Question', 'survey_id', 'condition'=>($moduleName == 'admin')?null:'status=1'),
);
}
i don’t know how to get module name or other ways.
Please help!
Thank you!