From 06cfa93adf269aae7ddf203b55dacbc20a3b3cbf Mon Sep 17 00:00:00 2001 From: iIronside Date: Tue, 21 Feb 2023 21:20:13 +0300 Subject: [PATCH] add status to login method --- ...221_181446_add_partner_to_status_table.php | 43 +++++++++++++++++++ .../api/controllers/UserController.php | 1 + 2 files changed, 44 insertions(+) create mode 100644 console/migrations/m230221_181446_add_partner_to_status_table.php diff --git a/console/migrations/m230221_181446_add_partner_to_status_table.php b/console/migrations/m230221_181446_add_partner_to_status_table.php new file mode 100644 index 0000000..190d4e3 --- /dev/null +++ b/console/migrations/m230221_181446_add_partner_to_status_table.php @@ -0,0 +1,43 @@ +insert('status', + [ + 'name' => 'Партнер', + ]); + } + + /** + * {@inheritdoc} + */ + public function safeDown() + { + $this->delete('status', ['name' => 'Партнер']); + } + + /* + // Use up()/down() to run migration code without a transaction. + public function up() + { + + } + + public function down() + { + echo "m230221_181446_add_partner_to_status_table cannot be reverted.\n"; + + return false; + } + */ +} diff --git a/frontend/modules/api/controllers/UserController.php b/frontend/modules/api/controllers/UserController.php index 375951f..4a87746 100755 --- a/frontend/modules/api/controllers/UserController.php +++ b/frontend/modules/api/controllers/UserController.php @@ -66,6 +66,7 @@ class UserController extends ActiveController 'access_token' => $model->login(), 'access_token_expired_at' => $model->getUser()->getTokenExpiredAt(), 'id' => $model->getUser()->id, + 'status' => $model->getUser()->status, 'card_id' => $model->getUser()->userCard->id ?? null, ]; } else {