|
@@ -83,8 +83,13 @@ class GenerateTreeCommand extends Command
|
|
// top level controller-action
|
|
// top level controller-action
|
|
if(strpos($line, "/") !== FALSE) {
|
|
if(strpos($line, "/") !== FALSE) {
|
|
if(!empty($currentController)) {
|
|
if(!empty($currentController)) {
|
|
|
|
+ $parts = explode(":", $line);
|
|
|
|
+ $line = $parts[0];
|
|
$method = explode("/", $line)[1];
|
|
$method = explode("/", $line)[1];
|
|
$newMethod = $currentController->addMethod($method, "/" . $line);
|
|
$newMethod = $currentController->addMethod($method, "/" . $line);
|
|
|
|
+ if(count($parts) > 1) {
|
|
|
|
+ $newMethod->api = $parts[count($parts) - 1];
|
|
|
|
+ }
|
|
// create _SINGLE_ controller if view
|
|
// create _SINGLE_ controller if view
|
|
if($method === "view") {
|
|
if($method === "view") {
|
|
$currentSubController = new GenController($currentRoot, $currentController->name . "_SINGLE");
|
|
$currentSubController = new GenController($currentRoot, $currentController->name . "_SINGLE");
|
|
@@ -510,7 +515,7 @@ 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/{$this->snakeToCamelCase($controller->dbTable)}/create", $text);
|
|
|
|
|
|
+ $text = str_replace("_API_", "/api/{$this->snakeToCamelCase($controller->dbTable)}/{$method->api}", $text);
|
|
$text = str_replace("_BACK_ROUTE_", "{$controller->name}-index", $text);
|
|
$text = str_replace("_BACK_ROUTE_", "{$controller->name}-index", $text);
|
|
$text = str_replace("_RETURN_ROUTE_", "{$controller->name}-add_new", $text);
|
|
$text = str_replace("_RETURN_ROUTE_", "{$controller->name}-add_new", $text);
|
|
$columns = $method->data;
|
|
$columns = $method->data;
|
|
@@ -660,6 +665,7 @@ class GenControllerMethod {
|
|
public $parentSub = false;
|
|
public $parentSub = false;
|
|
public $childAddRoute = false;
|
|
public $childAddRoute = false;
|
|
public $table = false;
|
|
public $table = false;
|
|
|
|
+ public $api = 'create';
|
|
public function __construct($name, $route)
|
|
public function __construct($name, $route)
|
|
{
|
|
{
|
|
$this->name = $name;
|
|
$this->name = $name;
|