guild/frontend/modules/api/models/User.php

29 lines
567 B
PHP
Raw Normal View History

2023-10-11 23:19:30 +03:00
<?php
namespace frontend\modules\api\models;
use backend\modules\card\models\UserCardSearch;
use common\services\ProfileService;
class User extends \common\models\User
{
/**
* @return string[]
*/
public function fields(): array
{
return [
'email',
'username',
'userCard' => function () {
2023-10-12 10:45:39 +03:00
if(isset($this->userCard->id)){
return ProfileService::getProfileById($this->userCard->id);
}
return null;
2023-10-11 23:19:30 +03:00
}
];
}
}