File: /var/www/vhosts/creativefellows.nl/okaycolor.creativefellows.nl/src/routes.php
<?php
use Slim\App;
use Slim\Http\Request;
use Slim\Http\Response;
return function (App $app) {
/*
* Admin
*/
$app->group('/admin', function(){
// dashboard
$this->get('', 'Admin:viewDashboard')->setName("admin.dashboard");
$this->get('/', 'Admin:viewDashboard')->setName("admin.dashboard");
//customers
$this->group('/customers', function(){
$this->get('[?p={params:.*}]', 'Admin:viewCustomers')->setName("admin.customers");
$this->get('/new', 'Admin:newCustomer')->setName("admin.customer.new");
$this->get('/{id:[0-9]+}', 'Admin:viewCustomer')->setName("admin.customer.view");
$this->patch('/{id:[0-9]+}', 'Admin:patchCustomer')->setName("admin.customer.patch");
});
// settings
$this->group('/settings', function(){
// default
$this->get('', 'Admin:viewSection')->setName("admin.settings");
// duplicate
$this->get('/duplicate/{id:[0-9]+}', 'Admin:duplicateProduct')->setName("admin.product.duplicate");
// post new product
$this->post('/product', 'Admin:postProduct')->setName("admin.product.post");
// other
$this->get('/{section}[?p={params:.*}]', 'Admin:viewSection')->setName("admin.section");
$this->get('/{section}/{id:[0-9]+}', 'Admin:viewSection')->setName("admin.section.view");
$this->get('/{section}/new', 'Admin:newSection')->setName("admin.section.new");
//update item
$this->patch('/{section}/{id:[0-9]+}', 'Admin:patch')->setName("admin.section.patch");
// new
$this->post('/{section}', 'Admin:post')->setName("admin.section.post");
// delete
$this->get('/delete/{section}/{id:[0-9]+}', 'Admin:delete')->setName("admin.section.delete");
});
// MISC
$this->get('/product/{product_id}/selected-options/{group_id}', 'Admin:getSelectedOptions'); // product/1/selected-opions
});
/*
* Uploads
*/
$app->group('/uploader', function(){
$this->get('', 'Printgarden:initUpload');//->setName("upload.init");
});
$app->post('/upload/file', 'Uploader:upload');
$app->get('/upload/{filename}', 'Printgarden:viewUpload');
/*
* Shopping
*/
$app->group('/cart', function(){
$this->get('', 'Printgarden:viewCart')->setName("cart.overview");
$this->post('/delivery', 'Printgarden:postDelivery')->setName("cart.delivery");
$this->post('/confirm', 'Printgarden:confirmCart')->setName("cart.confirm");
$this->post('/{product}', 'Printgarden:addCart')->setName("cart.post");
$this->post('/upload/patch/{uid}', 'Printgarden:setUpload')->setName("cart.set.upload");
$this->delete('/delete/{uid}', 'Printgarden:deleteCartItem')->setName("cart.delete.item");
});
/*
* Customer
*/
$app->group('/customer', function(){
//$this->get('', 'Printgarden:viewCart')->setName("cart.overview");
$this->get('/address/search', 'Printgarden:searchAddress')->setName("customer.search.address");
$this->post('/address', 'Printgarden:postAddress')->setName("customer.post.address");
});
// home
$app->get('/', 'Printgarden:viewHome');
// home
$app->get('/search', 'Printgarden:searchProducts');
// view page
$app->get('/{product}', 'Printgarden:viewProduct');
// get prices on product
$app->post('/calculate/{product}', 'Printgarden:calculatePrices');
// view page
$app->get('/klantenservice/{page}', 'Printgarden:viewPage');
// get prices on product
};