/** * @inheritdoc */ public function __construct($id = null, $config = null) { parent::__construct($config); if ($id) { // one user if ($user = UserRecord::findById($id)) { $this->user = $user; } else { throw new UserNotFoundException(); } } else { // all users $this->users = UserRecord::find(); } }
/** * @inheritdoc */ public function restore() { $this->recordStatus = static::RECORDSTATUS_USED; return parent::restore(); }
/** * @inheritdoc */ public function restore() { $this->status = static::STATUS_ACTIVE; return parent::restore(); }
public function scenarios() { $scenarios = parent::scenarios(); $scenarios[self::SCENARIO_PASSWORD_RESET] = ['password', 'passwordConfirm']; return $scenarios; }
/** * return 'delete' link parameter * * @return array */ public function getParamsDelete() { $primaryKey = $this->model->primaryKey()[0]; return ['url' => [$this->actionRoute('delete'), $primaryKey => $this->model->getAttribute($primaryKey), 'ru' => ReturnUrl::getToken()], 'label' => 'Delete', 'icon' => Icon::create('trash'), 'linkOptions' => ['data-confirm' => 'Are you sure to delete this item?', 'data-method' => 'post', 'class' => 'text text-danger'], 'buttonOptions' => ['class' => 'btn btn-danger']]; }