| Current Path : /var/www/html/portalv2/frontend/controllers/ |
| Current File : /var/www/html/portalv2/frontend/controllers/AiDynawebController.php |
<?php
namespace frontend\controllers;
use Yii;
use yii\web\Controller;
use yii\filters\VerbFilter;
use backend\modules\aidynaweb\components\DynawebApi;
/**
* FileQnaController implements the CRUD actions for FileQna model.
*/
class AiDynawebController extends Controller
{
/**
* @inheritdoc
*/
public function beforeAction($action)
{
// // if ($action->id == 'my-method') {
// $this->enableCsrfValidation = false;
// // }
return parent::beforeAction($action);
}
/**
* {@inheritdoc}
*/
public function behaviors()
{
return [
'verbs' => [
'class' => VerbFilter::className(),
'actions' => [
'delete' => ['POST'],
'get-bearer' => ['POST']
],
],
];
}
/**
* Lists all FileQna models.
* @return mixed
*/
public function actionIndex(){
}
/**
* Lists all FileQna models.
* @return mixed
*/
public function actionGetBearer()
{
try {
if($post = Yii::$app->request->post()) {
$this->asJson([
'success' => true,
'token' => DynawebApi::getToken($post['payload'], $post['nonce']),
'payload' => $post['payload'] . $post['nonce']
]
);
}
} catch (\Throwable $t) {
return $this->asJson(['success' => false, 'message' => $t->getMessage()]);
}
}
}