Exemple #1
0
    ProductController::get_products('Juoma');
});
$routes->get('/tuotteet/pizzat', function () {
    ProductController::get_products('Pizza');
});
$routes->get('/tuotteet/salaatit', function () {
    ProductController::get_products('Salaatti');
});
$routes->get('/tuotteet/:category/lisaa', 'check_logged_in', 'check_if_admin', function ($category) {
    ProductController::add_form($category);
});
$routes->post('/tuotteet/:category/lisaa', 'check_logged_in', 'check_if_admin', function () {
    ProductController::add();
});
$routes->get('/tuotteet/:category/:id/muokkaa', 'check_logged_in', 'check_if_admin', function ($category, $id) {
    ProductController::edit_form($id);
});
$routes->post('/tuotteet/:category/:id/muokkaa', 'check_logged_in', 'check_if_admin', function ($category, $id) {
    ProductController::edit($id);
});
$routes->post('/tuotteet/:id/poista', 'check_logged_in', 'check_if_admin', function ($id) {
    ProductController::delete($id);
});
$routes->get('/ainesosat', 'check_logged_in', 'check_if_admin', function () {
    IngredientController::get_ingredients();
});
$routes->get('/ainesosat/:id/muokkaa', 'check_logged_in', 'check_if_admin', function ($id) {
    IngredientController::edit_form($id);
});
$routes->post('/ainesosat/:id/muokkaa', 'check_logged_in', 'check_if_admin', function ($id) {
    IngredientController::edit($id);