guild/frontend/modules/access/models/Access.php

27 lines
702 B
PHP
Raw Normal View History

2020-01-21 17:33:07 +03:00
<?php
namespace frontend\modules\access\models;
use common\models\UserCardAccesses;
use frontend\modules\card\models\UserCard;
use Yii;
class Access extends \common\models\Accesses
{
public function init()
{
parent::init();
}
public function afterSave($insert, $changedAttributes)
{
parent::afterSave($insert, $changedAttributes); // TODO: Change the autogenerated stub
$user_card = UserCard::findOne(['id_user' => Yii::$app->user->identity->id]);
$user_card_access = new UserCardAccesses();
$user_card_access->user_card_id = $user_card->id;
$user_card_access->accesses_id = $this->id;
$user_card_access->save();
}
}