}); $routes->get('/login', function () { UserController::login(); }); $routes->post('/login', function () { UserController::handle_login(); }); $routes->get('/request/:id/edit', function ($id) { RequestController::edit($id); }); $routes->post('/request/:id/edit', function ($id) { RequestController::update($id); }); $routes->post('/request/:id/destroy', function ($id) { RequestController::destroy($id); }); $routes->get('/data', function () { TweetController::data(); }); // Tilauksen lisääminen tietokantaan $routes->post('/scraper', function () { RequestController::store(); RequestControler::scrape(); }); // Tilauslomakkeen näyttäminen $routes->get('/request', function () { RequestController::create(); }); $routes->get('/request/:id', function ($id) { RequestController::show($id); });
require 'controladores/products.php'; ProductController::update(); break; case 'GET | pedidos': autorizar(false); require 'controladores/requests.php'; RequestController::lista(); break; case 'POST | pedidos': autorizar(false); require 'controladores/requests.php'; RequestController::crear(); break; case 'POST | pedido/eliminar': autorizar(false); require 'controladores/requests.php'; RequestController::eliminar(); break; case 'POST | pedido/comprar': autorizar(); require 'controladores/requests.php'; RequestController::completar(); break; case 'GET | email': require 'controladores/email.php'; EmailController::enviar(); break; default: $vista = '404.php'; break; }
<?php include 'request_controller.php'; $controller = new RequestController(); echo json_encode($controller->execute());