2023-10-20 15:02:59 +03:00
|
|
|
<?php
|
|
|
|
|
2023-10-25 14:37:29 +03:00
|
|
|
namespace frontend\modules\api\models\profile\forms;
|
|
|
|
use frontend\modules\api\models\profile\User;
|
2023-10-20 15:02:59 +03:00
|
|
|
use yii\base\Model;
|
|
|
|
|
|
|
|
class ProfileChangeEmailForm extends Model
|
|
|
|
{
|
|
|
|
public $newEmail;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return array
|
|
|
|
*/
|
|
|
|
public function rules()
|
|
|
|
{
|
|
|
|
return [
|
|
|
|
[['newEmail'], 'string'],
|
|
|
|
[['newEmail'], 'required'],
|
|
|
|
[['newEmail'], 'email'],
|
|
|
|
['newEmail', 'unique', 'targetAttribute' => 'email', 'targetClass' => User::class],
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
public function formName(): string
|
|
|
|
{
|
|
|
|
return '';
|
|
|
|
}
|
|
|
|
}
|