Рефакторинг. В АПИ добавлены методы в изменения: username, email, password
This commit is contained in:
28
frontend/modules/api/models/profile/User.php
Normal file
28
frontend/modules/api/models/profile/User.php
Normal file
@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace frontend\modules\api\models\profile;
|
||||
|
||||
use frontend\modules\api\services\ProfileService;
|
||||
|
||||
class User extends \common\models\User
|
||||
{
|
||||
|
||||
/**
|
||||
* @return string[]
|
||||
*/
|
||||
public function fields(): array
|
||||
{
|
||||
return [
|
||||
'email',
|
||||
'username',
|
||||
'userCard' => function () {
|
||||
if(isset($this->userCard->id)){
|
||||
return ProfileService::getProfileById($this->userCard->id);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user