cutler movar doormove reception ui changes
This commit is contained in:
48
frontend/controllers/VirtualKeyController.php
Normal file
48
frontend/controllers/VirtualKeyController.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace frontend\controllers;
|
||||
|
||||
use common\components\DateUtil;
|
||||
use common\components\Helper;
|
||||
use common\manager\VirtualKeyManager;
|
||||
use common\models\Card;
|
||||
use common\models\VirtualKey;
|
||||
use Yii;
|
||||
use common\models\City;
|
||||
use yii\web\BadRequestHttpException;
|
||||
use yii\web\Controller;
|
||||
use yii\web\NotFoundHttpException;
|
||||
use yii\filters\VerbFilter;
|
||||
|
||||
/**
|
||||
* CityController implements the CRUD actions for City model.
|
||||
*/
|
||||
class VirtualKeyController extends Controller
|
||||
{
|
||||
public function behaviors()
|
||||
{
|
||||
return [
|
||||
'verbs' => [
|
||||
'class' => VerbFilter::className(),
|
||||
'actions' => [
|
||||
'allow-card' => ['post'],
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
public function actionAllowCard($idCard)
|
||||
{
|
||||
$card = Card::findOne($idCard);
|
||||
if (!isset($card)){
|
||||
throw new BadRequestHttpException("card id not found");
|
||||
}
|
||||
|
||||
$VirtualKeyManager = new VirtualKeyManager();
|
||||
$VirtualKeyManager->createNewVirtualKey($idCard);
|
||||
|
||||
$this->redirect(['customer/reception', 'number' => $card->number]);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user