|
@@ -29,6 +29,8 @@ class GenerateTreeCommand extends Command
|
|
|
$lines = ['<?php', '', 'use Illuminate\Support\Facades\Route;', '', ''];
|
|
|
file_put_contents(base_path("routes/generated.php"), implode("\n", $lines));
|
|
|
|
|
|
+ $sideLinks = [];
|
|
|
+
|
|
|
global $argv;
|
|
|
$file = fopen($argv[2], "r");
|
|
|
$lines = [];
|
|
@@ -99,6 +101,13 @@ class GenerateTreeCommand extends Command
|
|
|
}
|
|
|
$currentSubType = '';
|
|
|
$currentSubController = new GenController();
|
|
|
+
|
|
|
+ $sideLinks[] = "<li class='nav-item'><a href='/{$currentController->name}' " .
|
|
|
+ "class='nav-link " .
|
|
|
+ "{{ (isset(request()->route()->getController()->selfName) && strpos(request()->route()->getController()->selfName, '{$currentController->name}') === 0 ? 'active' : '') }}" . " '>" .
|
|
|
+ "<i class='nav-icon fa fa-user'></i>" .
|
|
|
+ "<p>" . $currentController->snakeToTitleCase($currentController->name) . "</p>" .
|
|
|
+ "</a></li>";
|
|
|
}
|
|
|
break;
|
|
|
|
|
@@ -138,6 +147,10 @@ class GenerateTreeCommand extends Command
|
|
|
|
|
|
echo "Saved " . base_path("routes/generated.php") . "\n";
|
|
|
|
|
|
+ // save side links
|
|
|
+ file_put_contents(resource_path("views/layouts/generated-links.blade.php"), implode("\n", $sideLinks));
|
|
|
+ echo "Saved " . resource_path("views/layouts/generated-links.blade.php") . "\n";
|
|
|
+
|
|
|
}
|
|
|
|
|
|
private function numLS($line) {
|
|
@@ -364,10 +377,10 @@ class GenController {
|
|
|
for($i=0; $i<$level; $i++) echo "\t";
|
|
|
echo "$line\n";
|
|
|
}
|
|
|
- private function snakeToTitleCase($text) {
|
|
|
+ public function snakeToTitleCase($text) {
|
|
|
return ucwords(str_replace("_", " ", $text));
|
|
|
}
|
|
|
- private function camelToTitleCase($text) {
|
|
|
+ public function camelToTitleCase($text) {
|
|
|
$text = preg_replace("/([A-Z])/", " $1", $text);
|
|
|
return ucwords($text);
|
|
|
}
|