2021-07-09 11:53:24 +02:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* @package yii2-bootstrap5
|
|
|
|
* @author Simon Karlen <simi.albi@outlook.com>
|
|
|
|
*/
|
|
|
|
|
|
|
|
namespace yiiunit\extensions\bootstrap5\data;
|
|
|
|
|
|
|
|
|
|
|
|
use yii\base\Model;
|
|
|
|
|
|
|
|
class User extends Model
|
|
|
|
{
|
2021-08-16 09:48:14 +02:00
|
|
|
public $id;
|
2021-07-09 11:53:24 +02:00
|
|
|
public $firstName;
|
|
|
|
public $lastName;
|
|
|
|
public $username;
|
|
|
|
public $password;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* {@inheritdoc}
|
|
|
|
*/
|
|
|
|
public function rules()
|
|
|
|
{
|
|
|
|
return [
|
2021-08-16 09:48:14 +02:00
|
|
|
['id', 'integer'],
|
|
|
|
[['firstName', 'lastName'], 'string'],
|
2021-07-09 11:53:24 +02:00
|
|
|
['username', 'string', 'min' => 4],
|
|
|
|
['password', 'string', 'min' => 8, 'max' => '20'],
|
|
|
|
[['username', 'password'], 'required']
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* {@inheritdoc}
|
|
|
|
*/
|
|
|
|
public function attributeHints()
|
|
|
|
{
|
|
|
|
return [
|
|
|
|
'username' => 'Your username must be at least 4 characters long',
|
|
|
|
'password' => 'Your password must be 8-20 characters long, contain letters and numbers, and must not contain spaces, special characters, or emoji.'
|
|
|
|
];
|
|
|
|
}
|
|
|
|
}
|