i am newby on yii.
I am using user and rigths yii extension. I have create model and views using gii. Each user belongs to an a domain
+----------------+
| users |
|----------------|
| id |
| username |
| ... |
| id_from |
+----------------+
+----------------+
| from |
|----------------|
| id |
| desc |
+----------------+
+----------------+
| data |
|----------------|
| id_user |
| data_1 |
| data_2 |
| ...... |
+----------------+
besides of the roll of each user. when I use the created views, each user can see all data but I need that each user see only their own data. How could I do it?
is like put a filter or somthing like that for each kind of user.
thx in advance
$model = Data::model()->findallbyattributes(array('id_user'=>Yii::app()->user->id));
$this->render('yourviewfile', array('model'=>$model));
and then in your view file
foreach($model as $m){
echo $m['data_1'].','.$m['data_2'];
}