Настроен behaviors для профиля
This commit is contained in:
parent
028cce3bef
commit
1ee8f198ac
@ -8,11 +8,33 @@ use common\models\FieldsValueNew;
|
||||
use Yii;
|
||||
use frontend\modules\card\models\UserCard;
|
||||
use yii\data\ActiveDataProvider;
|
||||
use yii\filters\AccessControl;
|
||||
use yii\filters\VerbFilter;
|
||||
use yii\web\Controller;
|
||||
use yii\web\NotFoundHttpException;
|
||||
|
||||
class UserCardController extends Controller
|
||||
{
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function behaviors()
|
||||
{
|
||||
return [
|
||||
'access' => [
|
||||
'class' => AccessControl::className(),
|
||||
'only' => ['index', 'update'],
|
||||
'rules' => [
|
||||
[
|
||||
'allow' => true,
|
||||
'roles' => ['@'],
|
||||
],
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays a single Product model.
|
||||
* @return mixed
|
||||
@ -20,8 +42,6 @@ class UserCardController extends Controller
|
||||
*/
|
||||
public function actionIndex()
|
||||
{
|
||||
if(Yii::$app->user->isGuest) return $this->render('index', ['info' => '<h3>Пожалуйста, авторизируйтесь!</h3>']);
|
||||
else {
|
||||
$id_user = Yii::$app->user->id;
|
||||
$result = UserCard::find()->where(['id_user' => $id_user])->asArray()->all();
|
||||
|
||||
@ -46,7 +66,6 @@ class UserCardController extends Controller
|
||||
}
|
||||
else return $this->render('index', ['info' => '<h3>Ваши личные данные не заненсены в базу.</h3>']);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates an existing UserCard model.
|
||||
|
Loading…
Reference in New Issue
Block a user