Hi,
I’m new to the yii framework. I installed the advanced template and I generated a CRUD using the Gii tool.
My app is able to register new users and log them into the backend. Each user is able to create Events and the events are shown on the GridView provided with the CRUD generated files. I want to make the grid view only show the events that each author created (SELECT * from event, user where event.id_author = user.id and user.id = “some_id”) but I can’t find where or how to modify the initial data that loads with the GridView.
I know it should be very simple but I have not been able to find any information about it.
I supose that it should be here?
public function actionIndex()
{
echo Yii::$app->user->identity->id;
$searchModel = new EventoSearch();
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
return $this->render('index', [
'searchModel' => $searchModel,
'dataProvider' => $dataProvider,
]);
}
Thanks in advanced!