Котнтроллер Users:
<?php
public function startAction() {
if(!Users::findFirstByIp($this->request->getClientAddress())){
$start = new Users();
$login = 'Воитель'.(count($start::find()) + 1);
$start->login = $login;
$start->ip = $this->request->getClientAddress();
$start->updated_at = (string) \Сontrario\Carbon::now();
$start->created_at = (string) \Сontrario\Carbon::now();
$start->password = $this->security->hash('temp');
if ($start->save()) {
if ($this->auth->attempt(array('login' => $login, 'password' => 'temp'))) {
$start = $this->auth->user();
$this->flash->success('Регистрация прошла успешно. Добро пожаловать, '.$start->login);
$this->response->redirect();
$this->view->disable();
}
}
}
else {
$this->response->redirect();
$this->view->disable();
}
}