gmarche/src/Gmarche/GmarcheModule.php

29 lines
957 B
PHP

<?php
namespace App\Gmarche;
use App\Gmarche\Actions\AntenneShowAction;
use App\Gmarche\Actions\RegionIndexAction;
use Framework\Auth;
use Framework\Module;
use Framework\Renderer\RendererInterface;
use Framework\Router;
use Psr\Container\ContainerInterface;
class GmarcheModule extends Module
{
const DEFINITIONS = __DIR__ . '/config.php';
const MIGRATIONS = __DIR__ . '/db/migrations';
const SEEDS = __DIR__ . '/db/seeds';
public function __construct(ContainerInterface $container, Auth $auth)
{
$this->auth = $auth;
$gmarchePrefix = $container->get('gmarche.prefix');
$container->get(RendererInterface::class)->addPath('gmarche', __DIR__ . '/views');
$router = $container->get(Router::class);
$router->get("$gmarchePrefix", RegionIndexAction::class, 'gmarche.index');
$router->get("$gmarchePrefix{france}/{slug:[a-z\-0-9]+}", AntenneShowAction::class, 'gmarche.antenne');
}
}