// Controlpanel
$routes->get('/controlpanel', 'admin', function () {
    AuthController::controlpanel();
});
// Users
$routes->get('/users', 'admin', function () {
    UsersController::index();
});
$routes->get('/users/create', 'admin', function () {
    UsersController::create();
});
$routes->post('/users/store', 'admin', function () {
    UsersController::store();
});
$routes->get('/users/:id/destroy', 'admin', function ($id) {
    UsersController::destroy($id);
});
// Roles
$routes->get('/roles', 'admin', function () {
    RolesController::index();
});
$routes->get('/roles/create', 'admin', function () {
    RolesController::create();
});
$routes->post('/roles/store', 'admin', function () {
    RolesController::store();
});
$routes->get('/roles/:id/edit', 'admin', function ($id) {
    RolesController::edit($id);
});
$routes->post('/roles/:id/update', 'admin', function ($id) {
Esempio n. 2
0
$app->get($basePath . '/users/experience', function (Request $request) use($app, $UsersController, $UserModel) {
    $params = $request->query->all();
    $errorMessage = $UserModel->validate($params, 'experience');
    if ($errorMessage) {
        return Utils::formatErrorMessage(ERROR_BAD_MODEL, $errorMessage);
    } else {
        return $UsersController->experience($params);
    }
});
$app->post($basePath . '/users/destroy', function (Request $request) use($app, $UsersController, $UserModel) {
    $params = $request->query->all();
    $errorMessage = $UserModel->validate($params, 'destroy');
    if ($errorMessage) {
        return Utils::formatErrorMessage(ERROR_BAD_MODEL, $errorMessage);
    } else {
        return $UsersController->destroy($params);
    }
});
/*
 * Resources
 */
$app->get($basePath . '/resources', function (Request $request) use($app, $ResourcesController, $ResourceModel) {
    $params = $request->query->all();
    $errorMessage = $ResourceModel->validate($params);
    if ($errorMessage) {
        return Utils::formatErrorMessage(ERROR_BAD_MODEL, $errorMessage);
    } else {
        return $ResourcesController->index($params);
    }
});
$app->get($basePath . '/resources/offering', function (Request $request) use($app, $ResourcesController, $ResourceModel) {