has card
This commit is contained in:
parent
63f88f425e
commit
7e9d2cf5a7
@ -9,6 +9,7 @@ use kernel\helpers\Debug;
|
|||||||
use kernel\app_modules\card\models\Card;
|
use kernel\app_modules\card\models\Card;
|
||||||
use kernel\FormModel;
|
use kernel\FormModel;
|
||||||
use kernel\helpers\ImageGD;
|
use kernel\helpers\ImageGD;
|
||||||
|
use kernel\modules\user\models\User;
|
||||||
|
|
||||||
class CardService
|
class CardService
|
||||||
{
|
{
|
||||||
@ -105,4 +106,14 @@ class CardService
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function userHasCard(int $userId): bool
|
||||||
|
{
|
||||||
|
$card = Card::where("user_id", $userId)->first();
|
||||||
|
if ($card){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
@ -49,10 +49,14 @@ class TgBotRestController extends RestController
|
|||||||
|
|
||||||
$this->model->save();
|
$this->model->save();
|
||||||
|
|
||||||
$this->renderApi($this->model->toArray());
|
$resArr = $tgBot->toArray();
|
||||||
|
$resArr['has_card'] = CardService::userHasCard($resArr['user_id']);
|
||||||
|
$this->renderApi($resArr);
|
||||||
}
|
}
|
||||||
|
$resArr = $tgBot->toArray();
|
||||||
|
$resArr['has_card'] = CardService::userHasCard($resArr['user_id']);
|
||||||
|
|
||||||
$this->renderApi($tgBot->toArray());
|
$this->renderApi($resArr);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[NoReturn] public function actionCreateCard(): void
|
#[NoReturn] public function actionCreateCard(): void
|
||||||
|
Loading…
x
Reference in New Issue
Block a user