Answer the question
In order to leave comments, you need to log in
Add YII2 status?
How to add a couple more statuses?
We have
const STATUS_ACTIVE = 10;
const STATUS_USER = 15;
const STATUS_DELETED = 0;
const STATUS_ACTIVE = 10;
const STATUS_WAIT = 2;
const STATUS_USER = 15;
and inpublic function rules()
{
return [
['status', 'default', 'value' => self::STATUS_ACTIVE],
['status', 'in', 'range' => [
self::STATUS_ACTIVE,
self::STATUS_DELETED,
self::STATUS_WAIT,
self::STATUS_USER
]],
];
}
Answer the question
In order to leave comments, you need to log in
Look towards the findIdentity() method, if I understand your picture correctly, then the whole point is hidden there)
rules is form validation. It allows or forbids saving a user with this status. And access rulitsya in the controller.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question