Exemplo n.º 1
0
})->bind('show_product');
$app->get('/category/{id}', function ($id) use($app, $CatalogRepository) {
    $page = new \App\Controller\Catalog($CatalogRepository, $app);
    return $page->page($id);
})->bind('show_category');
$app->get('/header', function () use($app, $ProductRepository) {
    $cart = new \App\Controller\Cart($ProductRepository, $app);
    $page = new \App\Controller\Header($cart, $app);
    return $page->page();
})->bind('header');
$app->get('/side_menu', function () use($app, $CatalogRepository) {
    $page = new \App\Controller\SideMenu($CatalogRepository, $app);
    return $page->page();
})->bind('side_menu');
$app->get('/add_to_cart/{product_id}', function ($product_id) use($app, $ProductRepository) {
    $cart = new \App\Controller\Cart($ProductRepository, $app);
    $cart->add($product_id);
    return $app->redirect('/');
})->bind('add_to_cart');
$app->get('/cart/{in_cart}', function ($in_cart) use($app, $ProductRepository) {
    $page = new \App\Controller\Cart($ProductRepository, $app);
    return $page->page($in_cart);
})->bind('cart');
$app->get('/order', function () use($app, $ProductRepository, $OrderRepository) {
    $page = new \App\Controller\Order($ProductRepository, $OrderRepository, $app);
    return $page->order();
})->bind('order');
$app->post('/complete_order', function () use($app, $ProductRepository, $OrderRepository) {
    $page = new \App\Controller\Order($ProductRepository, $OrderRepository, $app);
    return $page->completeOrder();
})->bind('complete_order');
Exemplo n.º 2
0
})->bind('side_menu');
$app->get('/category/{id}', function ($id) use($app, $CatalogRepository) {
    $page = new \App\Controller\Catalog($CatalogRepository, $app);
    return $page->page($id);
})->bind('show_category');
$app->get('/product/{id}', function ($id) use($app, $ProductRepository) {
    $page = new \App\Controller\Product($ProductRepository, $app);
    return $page->page($id);
})->bind('show_product');
$app->get('/add_to_cart/{product_id}', function ($product_id) use($app, $ProductRepository) {
    $cart = new \App\Controller\Cart($ProductRepository, $app);
    $cart->add($product_id);
    return $app->redirect('/');
})->bind('add_to_cart');
$app->get('/cart/{in_cart}', function ($in_cart) use($app, $ProductRepository) {
    $page = new \App\Controller\Cart($ProductRepository, $app);
    return $page->page($in_cart);
})->bind('cart');
$app->get('/header', function () use($app, $ProductRepository) {
    $cart = new \App\Controller\Cart($ProductRepository, $app);
    $page = new \App\Controller\Header($cart, $app);
    return $page->page();
})->bind('header');
$app->get('/info', function () use($app) {
    $page = new \App\Controller\Info($app);
    return $page->page();
})->bind('info');
$app->get('/delivery', function () use($app) {
    $page = new \App\Controller\Delivery($app);
    return $page->page();
})->bind('delivery');