implement mobile devices in reception

This commit is contained in:
2022-02-19 15:28:41 +01:00
parent 34fca82e7d
commit ac5076534b
3 changed files with 37 additions and 48 deletions

View File

@@ -0,0 +1,30 @@
<?php
namespace mobileapi\manager;
use common\models\Card;
use Endroid\QrCode\QrCode;
class ApiManager
{
public function getCardPage(){
$customer = \Yii::$app->user->getIdentity();
if ( $customer == null ){
throw new \yii\web\NotFoundHttpException();
}
$card = Card::findOne($customer->id_customer_card);
if ( $card == null ){
throw new \yii\web\NotFoundHttpException();
}
$qrCode = new QrCode($card->number);
return [
'qrcode' => $qrCode->writeDataUri(),
'cardNumber' => $card->number,
'customerName' => $customer->name
];
}
}