Implement basic database access and login
This commit is contained in:
parent
8be7988d97
commit
b24fe56c8a
14 changed files with 307 additions and 31 deletions
|
|
@ -4,8 +4,10 @@ declare(strict_types=1);
|
|||
namespace MailAccountAdmin;
|
||||
|
||||
use DI\Container;
|
||||
use MailAccountAdmin\Common\UserHelper;
|
||||
use MailAccountAdmin\Frontend\Login\LoginController;
|
||||
use MailAccountAdmin\Frontend\Dashboard\DashboardController;
|
||||
use MailAccountAdmin\Repositories\AdminUserRepository;
|
||||
use PDO;
|
||||
use Psr\Container\ContainerInterface;
|
||||
use Slim\Views\Twig;
|
||||
|
|
@ -48,17 +50,34 @@ class Dependencies
|
|||
);
|
||||
});
|
||||
|
||||
// Repositories
|
||||
$container->set(AdminUserRepository::class, function (ContainerInterface $c) {
|
||||
return new AdminUserRepository(
|
||||
$c->get(self::DATABASE),
|
||||
);
|
||||
});
|
||||
|
||||
// Helper classes
|
||||
$container->set(UserHelper::class, function (ContainerInterface $c) {
|
||||
return new UserHelper(
|
||||
$c->get(AdminUserRepository::class),
|
||||
);
|
||||
});
|
||||
|
||||
// Login page
|
||||
$container->set(LoginController::class, function (ContainerInterface $c) {
|
||||
return new LoginController(
|
||||
$c->get(self::TWIG)
|
||||
$c->get(self::TWIG),
|
||||
$c->get(UserHelper::class),
|
||||
$c->get(AdminUserRepository::class),
|
||||
);
|
||||
});
|
||||
|
||||
// Dashboard
|
||||
$container->set(DashboardController::class, function (ContainerInterface $c) {
|
||||
return new DashboardController(
|
||||
$c->get(self::TWIG)
|
||||
$c->get(self::TWIG),
|
||||
$c->get(UserHelper::class),
|
||||
);
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue