You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: framework/console/CMakeControllerCommand.php
+23-1Lines changed: 23 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -26,7 +26,29 @@ class CMakeControllerCommand implements IConsoleCommand
26
26
*/
27
27
publicstaticfunctionhandle($param = '')
28
28
{
29
-
$output = 'Controller created: '.$param;
29
+
$output = '';
30
+
31
+
if (empty($param)) {
32
+
$output .= CConsole::redbg("No model name is defined. Type make:controller -h or --help").PHP_EOL;
33
+
}
34
+
elseif ($param === '-h' || $param === '--help') {
35
+
$output .= CConsole::yellow("Usage:") . PHP_EOL;
36
+
$output .= " make:controller [model]\t Create a new controller class". PHP_EOL;
37
+
$output .= "\t\t\t\t[model] - Generate a resource controller for the given model.". PHP_EOL;
38
+
}
39
+
elseif (CValidator::isVariable($param)) {
40
+
// TODO: create controller
41
+
}
42
+
else {
43
+
if (!CValidator::isVariable($param)){
44
+
$output .= CConsole::redbg("The model name must be a valid controller name (alphanumeric, starts with letter and can contain an underscore)! Please re-enter.").PHP_EOL;
45
+
} else {
46
+
$output .= CConsole::redbg("No model name is defined or wrong parameters. Type make:controller -h or --help").PHP_EOL;
0 commit comments