Browse Source

src: Set up controller

master
Elis Hirwing 3 years ago
parent
commit
9e6ae3fe07
Signed by: etu GPG Key ID: D57EFA625C9A925F
  1. 8
      public/index.php
  2. 9
      src/Etu/Controller/Inventory.php

8
public/index.php

@ -1,6 +1,7 @@
<?php
require_once(__DIR__.'/../vendor/autoload.php');
use Etu\Controller\Inventory as InventoryController;
use Psr\Http\Message\ServerRequestInterface as Request;
use Psr\Http\Message\ResponseInterface as Response;
@ -25,4 +26,11 @@ $container['logger'] = function (Slim\Container $c) {
return $logger;
};
/**
* Set up controllers
*/
$container[InventoryController::class] = function (Slim\Container $c) {
return new InventoryController($c['logger']);
};
$app->run();

9
src/Etu/Controller/Inventory.php

@ -1,6 +1,15 @@
<?php
namespace Etu\Controller;
use Monolog\Logger;
class Inventory
{
/** @var Logger */
private $logger;
public function __construct(Logger $logger)
{
$this->logger = $logger;
}
}

Loading…
Cancel
Save