controllers/AppController.php
/**
     * Lists all Users models.
     * @return mixed
     */
Lists all Users models.
@return mixed
Lists all Users models . @return mixed
public function actionIndex()
    {
        $user = $this->findModel(Yii::$app->user->identity->id);
        $session = Yii::$app->session;
        $session['nivel'] = $user->nivel;
        $pacientes = Pacientes::find()
            ->innerJoin('users_pacientes','`users_pacientes`.`pacientes_id` = `pacientes`.`id`')
            ->andWhere(['users_pacientes.users_id' => Yii::$app->user->identity->id])
            ->all();
        return $this->render('index', [
            'pacientes' => $pacientes
        ]);
    }
public function actionIndex ( ) { $ user = $ this -> findModel ( Yii :: $ app -> user -> identity -> id ) ; $ session = Yii :: $ app -> session ; $ session [ 'nivel' ] = $ user -> nivel ; $ pacientes = Pacientes :: find ( ) -> innerJoin ( 'users_pacientes' , '`users_pacientes`.`pacientes_id` = `pacientes`.`id`' ) -> andWhere ( [ 'users_pacientes.users_id' => Yii :: $ app -> user -> identity -> id ] ) -> all ( ) ; return $ this -> render ( 'index' , [ 'pacientes' => $ pacientes ] ) ; }
Lists all Users models.
Lists all Users models .
//Seteamos nivel en session