2023-10-11 23:19:30 +03:00
|
|
|
<?php
|
|
|
|
|
2023-10-20 15:02:59 +03:00
|
|
|
namespace frontend\modules\api\models\profile;
|
2023-10-11 23:19:30 +03:00
|
|
|
|
2023-10-20 15:02:59 +03:00
|
|
|
use frontend\modules\api\services\ProfileService;
|
2023-10-11 23:19:30 +03:00
|
|
|
|
|
|
|
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
|
|
|
}
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|