|
@@ -66,6 +66,13 @@ class GenerateTreeCommand extends Command
|
|
|
$ls = $this->numLS($line);
|
|
|
$line = trim($line);
|
|
|
|
|
|
+ $exitURL = false;
|
|
|
+ if(strpos($line, "=>") !== FALSE) {
|
|
|
+ $parts = explode("=>", $line);
|
|
|
+ $exitURL = str_replace("UID", "{{ \$subRecord->uid }}", $parts[1]);
|
|
|
+ $line = $parts[0];
|
|
|
+ }
|
|
|
+
|
|
|
$tokens = explode("|", $line);
|
|
|
$line = $tokens[0];
|
|
|
$dbTable = null;
|
|
@@ -194,6 +201,14 @@ class GenerateTreeCommand extends Command
|
|
|
case 16: // data for actions and subs
|
|
|
if(!empty($currentMethod)) {
|
|
|
$currentMethod->data[] = $line;
|
|
|
+ if($exitURL) {
|
|
|
+ if(strpos("=", $line) !== FALSE) {
|
|
|
+ $currentMethod->viewURL = $exitURL;
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ $currentMethod->exitURL = $exitURL;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
break;
|
|
|
|
|
@@ -297,6 +312,7 @@ class GenController {
|
|
|
}
|
|
|
$newMethod->parentSub = $this->name . '-' . $method->name;
|
|
|
$newMethod->table = explode(":", $method->data[1])[1];
|
|
|
+ $newMethod->exitURL = $method->exitURL;
|
|
|
$newMethods[] = $newMethod;
|
|
|
$method->childAddRoute = $this->name . '-' . $methodName;
|
|
|
}
|
|
@@ -541,7 +557,11 @@ class GenController {
|
|
|
$tds = [];
|
|
|
foreach ($columns as $column) {
|
|
|
$ths[] = "<th>{$this->snakeToTitleCase($column)}</th>";
|
|
|
- $tds[] = "<td><?= \$subRecord->$column ?></td>";
|
|
|
+ $tds[] = "<td>" .
|
|
|
+ ($method->exitURL && $column === 'uid' ? '<a href="' . $method->exitURL . '">' : '') .
|
|
|
+ "<?= \$subRecord->$column ?>" .
|
|
|
+ ($method->exitURL && $column === 'uid' ? '</a>' : '') .
|
|
|
+ "</td>";
|
|
|
}
|
|
|
$text = str_replace("<!-- __SCAFFOLD_THS__ -->", implode("\n", $ths), $text);
|
|
|
$text = str_replace("<!-- __SCAFFOLD_TDS__ -->", implode("\n", $tds), $text);
|
|
@@ -602,6 +622,8 @@ class GenController {
|
|
|
$this->w('Rout: ' . $method->route, 1);
|
|
|
$this->w('Meth: ' . $method->name . '($request' . ($method->hasUID ? ', $uid' : '') . ')', 1);
|
|
|
if(!empty($method->data)) $this->w('Data: ' . implode(", ", $method->data), 1);
|
|
|
+ $this->w('Exit: ' . $method->exitURL, 1);
|
|
|
+ $this->w('View: ' . $method->viewURL, 1);
|
|
|
if(!$method->redirect) {
|
|
|
$this->w('View: ' . resource_path("views/{$this->root}/{$this->name}/{$method->name}.blade.php"), 1);
|
|
|
}
|
|
@@ -725,6 +747,8 @@ class GenControllerMethod {
|
|
|
public $table = false;
|
|
|
public $api = 'create';
|
|
|
public $show = null;
|
|
|
+ public $viewURL = false;
|
|
|
+ public $exitURL = false;
|
|
|
public function __construct($name, $route)
|
|
|
{
|
|
|
$this->name = $name;
|