Skip to content

Commit

Permalink
select model table bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
monkenWu committed Mar 9, 2020
1 parent bd4203a commit 8cd8069
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 7 additions & 2 deletions src/Commands/CliCreate.php
Original file line number Diff line number Diff line change
Expand Up @@ -263,16 +263,21 @@ public static function selectTable(Array $namespaceArr){
$tbody = [];
foreach ($namespaceArr as $key => $value) {
if($key%2==0){
$tbody[] = [$key,$value];
$tbody[] = [($key+1),$value];
}else{
array_push($tbody[count($tbody)-1],$key,$value);
array_push($tbody[count($tbody)-1],($key+1),$value);
}
}

CLI::table($tbody,$thead);
$useID = CLI::prompt(
CLI::color("Please type the ID of the Namespace you want to use.\nIf you want to use muiltiple Namespace, then type muiltiple ID and separated it by \",\" ","blue")
);
while($useID == ""){
$useID = CLI::prompt(
CLI::color("Please type the ID of the Namespace you want to use.\nIf you want to use muiltiple Namespace, then type muiltiple ID and separated it by \",\" ","blue")
);
}

return $useID;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Commands/Controller/CreateController.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public function run(array $params = []){

$numArr = explode(",",$useID);
foreach ($numArr as $key => $value) {
$useModels .= "use {$modelList[$value]};\n" ?? "";
$useModels .= "use {$modelList[($value-1)]};\n" ?? "";
}
}

Expand Down

0 comments on commit 8cd8069

Please sign in to comment.