public function postChangePassword($req) { $ar = new AdminsRepository(); $admin = $ar->getById($req->id); $admin->password = password_hash($_POST['password'], PASSWORD_DEFAULT); $result = $admin->save(); if ($result) { $this->service->flash('The password was changed.', 'success'); } else { $this->service->flash('Can\'t change the password.', 'alert'); } return $this->service->back(); }