|
@@ -94,6 +94,7 @@ class GenerateTreeCommand extends Command
|
|
$currentSubController->sub = true;
|
|
$currentSubController->sub = true;
|
|
$newMethod->redirect = "/" . $line . "/SUB_dashboard";
|
|
$newMethod->redirect = "/" . $line . "/SUB_dashboard";
|
|
}
|
|
}
|
|
|
|
+ $currentMethod = $newMethod;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
// new top level controller
|
|
// new top level controller
|
|
@@ -123,10 +124,16 @@ class GenerateTreeCommand extends Command
|
|
|
|
|
|
case 8: // sub-type declaration
|
|
case 8: // sub-type declaration
|
|
|
|
|
|
- $currentSubType = $line;
|
|
|
|
|
|
+ if($line === 'ACTIONS' || $line === 'SUB') {
|
|
|
|
+ $currentSubType = $line;
|
|
|
|
+ }
|
|
|
|
+ else if (!empty($currentMethod) && $currentMethod->name === 'add_new') { // this is a field in add_new
|
|
|
|
+ $currentMethod->data[] = $line;
|
|
|
|
+ }
|
|
|
|
+
|
|
break;
|
|
break;
|
|
|
|
|
|
- case 12: // subs and actions
|
|
|
|
|
|
+ case 12: // ACTIONS | SUB | add_new fields
|
|
|
|
|
|
if($currentSubType === 'ACTIONS') {
|
|
if($currentSubType === 'ACTIONS') {
|
|
$currentMethod = $currentSubController->addMethod(
|
|
$currentMethod = $currentSubController->addMethod(
|
|
@@ -415,8 +422,10 @@ class GenController {
|
|
{
|
|
{
|
|
$text = file_get_contents(base_path('generatecv/tree-templates/add_new.template.blade.php'));
|
|
$text = file_get_contents(base_path('generatecv/tree-templates/add_new.template.blade.php'));
|
|
$text = str_replace("_NAME_", $this->snakeToTitleCase($controller->name), $text);
|
|
$text = str_replace("_NAME_", $this->snakeToTitleCase($controller->name), $text);
|
|
|
|
+ $text = str_replace("_API_", "/api/{$controller->dbTable}/create", $text);
|
|
$text = str_replace("_BACK_ROUTE_", "{$controller->name}-index", $text);
|
|
$text = str_replace("_BACK_ROUTE_", "{$controller->name}-index", $text);
|
|
- $columns = DB::getSchemaBuilder()->getColumnListing($controller->dbTable);
|
|
|
|
|
|
+ $text = str_replace("_RETURN_ROUTE_", "{$controller->name}-add_new", $text);
|
|
|
|
+ $columns = $method->data;
|
|
$fields = [];
|
|
$fields = [];
|
|
foreach ($columns as $column) {
|
|
foreach ($columns as $column) {
|
|
if(in_array($column,
|
|
if(in_array($column,
|