for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Rudolf\Modules\Users\One\Admin\Profile;
use Exception;
use Rudolf\Component\Alerts\Alert;
use Rudolf\Component\Alerts\AlertsCollection;
use Rudolf\Framework\Controller\AdminController;
class AddController extends AdminController
{
/**
* @throws Exception
*/
public function add()
if (isset($_POST['add'])) {
if (empty($_POST['password']) || trim($_POST['password']) !== $_POST['password_again']) {
AlertsCollection::add(
new Alert(
'error',
'Podane hasła nie są identyczne!'
)
);
$this->redirect(DIR . '/admin/users/add');
}
$addModel = new AddModel();
$id = ($addModel)->add($_POST);
if ($id) {
'success',
'Dodano użytkownika'
$addModel->flushCache('users');
$this->redirect(DIR . '/admin/users/edit/' . $id);
'Wystąpił nieoczekiwany błąd'
$view = new AddView();
$view->display();
$view->render();