|
@@ -75,6 +75,7 @@ class GenerateTreeCommand extends Command
|
|
|
|
|
|
$hasAdd = in_array("add", $tokens);
|
|
|
$hasView = in_array("view", $tokens);
|
|
|
+ $hasRemove = in_array("remove", $tokens);
|
|
|
|
|
|
switch($ls) {
|
|
|
|
|
@@ -102,6 +103,9 @@ class GenerateTreeCommand extends Command
|
|
|
else if(strpos($method, "add_new") === 0) {
|
|
|
$newMethod->type = 'add';
|
|
|
}
|
|
|
+ else if(strpos($method, "remove") === 0) {
|
|
|
+ $newMethod->type = 'remove';
|
|
|
+ }
|
|
|
$currentMethod = $newMethod;
|
|
|
}
|
|
|
}
|
|
@@ -114,6 +118,7 @@ class GenerateTreeCommand extends Command
|
|
|
$currentController->dbTable = $dbTable;
|
|
|
$currentController->hasAdd = $hasAdd;
|
|
|
$currentController->hasView = $hasView;
|
|
|
+ $currentController->hasRemove = $hasRemove;
|
|
|
$currentController->addMethod("index", "/$line");
|
|
|
if(!empty($currentSubController)) {
|
|
|
$currentSubController->save();
|
|
@@ -135,7 +140,9 @@ class GenerateTreeCommand extends Command
|
|
|
if($line === 'ACTIONS' || $line === 'SUB') {
|
|
|
$currentSubType = $line;
|
|
|
}
|
|
|
- else if (!empty($currentMethod) && strpos($currentMethod->name, 'add_new') === 0) { // this is a field in add_new
|
|
|
+ else if (!empty($currentMethod) &&
|
|
|
+ (strpos($currentMethod->name, 'add_new') === 0 ||
|
|
|
+ $currentMethod->name === 'remove')) { // this is a field in add_new
|
|
|
$currentMethod->data[] = $line;
|
|
|
}
|
|
|
|
|
@@ -213,6 +220,7 @@ class GenController {
|
|
|
public $dbTable = null;
|
|
|
public $hasAdd = false;
|
|
|
public $hasView = false;
|
|
|
+ public $hasRemove = false;
|
|
|
public $sub = false;
|
|
|
public $parentControllerName = '';
|
|
|
public $subLinksSaved = false;
|
|
@@ -332,6 +340,9 @@ class GenController {
|
|
|
else if(strpos($method->name, 'add_new') === 0 && $controller->hasAdd) {
|
|
|
$this->saveAddNewView($controller, $method);
|
|
|
}
|
|
|
+ else if($method->name === 'remove' && $controller->hasRemove) {
|
|
|
+ $this->saveAddNewView($controller, $method);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
}
|
|
@@ -356,6 +367,12 @@ class GenController {
|
|
|
$columns = DB::getSchemaBuilder()->getColumnListing($controller->dbTable);
|
|
|
$ths = [];
|
|
|
$tds = [];
|
|
|
+ if($controller->hasRemove) {
|
|
|
+ $ths[] = "<th></th>";
|
|
|
+ $tds[] = "<td><a href='/{$controller->name}/remove/<?= \$record->uid ?>'>" .
|
|
|
+ "<i class='fa fa-trash'></i>" .
|
|
|
+ "</a></td>";
|
|
|
+ }
|
|
|
foreach ($columns as $column) {
|
|
|
$ths[] = "<th>{$this->snakeToTitleCase($column)}</th>";
|
|
|
$tds[] = "<td>" .
|
|
@@ -600,6 +617,7 @@ class GenController {
|
|
|
if($dotPos !== FALSE) {
|
|
|
$display = substr($name, $dotPos + 1);
|
|
|
}
|
|
|
+ $display = preg_replace('/uid$/i', "", $display);
|
|
|
$type = "text";
|
|
|
$options = [];
|
|
|
if(count($tokens) > 1) {
|