default crud new function

This commit is contained in:
2019-12-05 22:54:52 +01:00
parent f85462ac40
commit b402eabeb9
6 changed files with 83 additions and 14 deletions

View File

@@ -67,10 +67,13 @@ class CRUDRoutesLoader
$defaults = [
'_controller' => $action['controller'] ?? $config['controller'].'::'.$name
];
if ($action === 'index') {
if ($name === 'index') {
$path = "{_locale}".$config['base_path'];
$route = new Route($path, $defaults);
} elseif ($name === 'new') {
$path = "{_locale}".$config['base_path'].'/'.$name;
$route = new Route($path, $defaults);
} else {
$path = "{_locale}".$config['base_path'].($action['path'] ?? '/{id}/'.$name);
$requirements = $action['requirements'] ?? [