guild/frontend/modules/access/controllers/AccessController.php
2019-12-10 17:22:20 +03:00

31 lines
872 B
PHP
Executable File

<?php
namespace frontend\modules\access\controllers;
use Yii;
use yii\web\Controller;
use yii\data\ActiveDataProvider;
use common\models\Accesses;
class AccessController extends Controller
{
/**
* @return mixed
*/
public function actionIndex()
{
$id_user = Yii::$app->user->id;
$query = "SELECT accesses.name, accesses.access FROM `accesses`, `user_card`, `user_card_accesses` WHERE user_card.id_user =" . $id_user . " AND user_card_accesses.user_card_id = user_card.id AND accesses.id = user_card_accesses.accesses_id ";
$access = Accesses::findBySql($query);
$dataProvider = new ActiveDataProvider([
'query' => $access,
'pagination' => [
'pageSize' => 200,
],
]);
return $this->render('index', compact('dataProvider', $dataProvider));
}
}