Last active
November 29, 2017 20:41
-
-
Save Rijen/5d2b136edabf6f24ff3daab6054b90f1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
function crud($base, $controller, $name, &$app) { | |
$app->group($base, function() use($app, $controller, $name) { | |
$app->get('', $controller . ':index')->setName($name); | |
$app->get('/create', $controller . ':getCreate')->setName($name . '.create'); | |
$app->get('/{id}/update', $controller . ':getUpdate'); | |
$app->get('/{id}/delete', $controller . ':getDelete'); | |
})->add(new RouteNameMiddleware($app->getContainer())); | |
$app->group($base, function() use($app, $controller) { | |
$app->post('/create', $controller . ':postCreate'); | |
$app->post('/{id}/update', $controller . ':postUpdate'); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment