Skip to content

Commit 991b2b2

Browse files
author
Mike Alhayek
committed
Fixes ccouple of bugs
1 parent e238ca1 commit 991b2b2

File tree

5 files changed

+13
-9
lines changed

5 files changed

+13
-9
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "crestapps/laravel-code-generator",
33
"license": "MIT",
44
"description": "A clean code generator for Laravel framework that will save you time! This awesome tool will help you generate resources like views, controllers, routes, migrations, languages or request-forms! It is extremely flexible and customizable to cover many use cases. It is shipped with cross-browsers compatible template, along with a client-side validation to modernize your application.",
5-
"version": "v2.1.0",
5+
"version": "v2.1.1",
66
"keywords": [
77
"laravel","crud","crud generator",
88
"laravel crud generator","laravel crud builder",

src/Commands/.php_cs.cache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"php":"7.1.1","version":"2.3.1:v2.3.1#d5257f7433bb490299c4f300d95598fd911a8ab0","rules":{"blank_line_after_namespace":true,"braces":true,"class_definition":true,"elseif":true,"function_declaration":true,"indentation_type":true,"line_ending":true,"lowercase_constants":true,"lowercase_keywords":true,"method_argument_space":true,"no_closing_tag":true,"no_spaces_after_function_name":true,"no_spaces_inside_parenthesis":true,"no_trailing_whitespace":true,"no_trailing_whitespace_in_comment":true,"single_blank_line_at_eof":true,"single_class_element_per_statement":{"elements":["property"]},"single_import_per_statement":true,"single_line_after_imports":true,"switch_case_semicolon_to_colon":true,"switch_case_space":true,"visibility_required":true,"encoding":true,"full_opening_tag":true},"hashes":{"CreateControllerCommand.php":-928426739,"CreateLanguageCommand.php":-687902967,"FieldsFileCreateCommand.php":-795365111,"CreateModelCommand.php":836566638,"CreateMappedResourcesCommand.php":1155836345,"CreateLayoutCommand.php":1508207172,"CreateIndexViewCommand.php":525196469,"CreateFormViewCommand.php":1554366852,"CreateFormRequestCommand.php":566161834,"CreateFieldsFileCommand.php":1682335243,"CreateEditViewCommand.php":-742651852,"CreateCreateViewCommand.php":724524289,"CreateMigrationCommand.php":-883410323,"FieldsFileReduceCommand.php":956898946,"FieldsFileDeleteCommand.php":427767776,"FieldsFileAppendCommand.php":-1234971934,"CreateViewsCommand.php":177655640,"CreateViewLayoutCommand.php":-694671571,"CreateShowViewCommand.php":-474640776,"CreateRoutesCommand.php":355117204,"CreateResourcesCommand.php":1572191191}}
1+
{"php":"7.1.6","version":"2.3.2:v2.3.2#597745f744bcce1aed59dfd1bb4603de2a06cda9","rules":{"blank_line_after_namespace":true,"braces":true,"class_definition":true,"elseif":true,"function_declaration":true,"indentation_type":true,"line_ending":true,"lowercase_constants":true,"lowercase_keywords":true,"method_argument_space":true,"no_closing_tag":true,"no_spaces_after_function_name":true,"no_spaces_inside_parenthesis":true,"no_trailing_whitespace":true,"no_trailing_whitespace_in_comment":true,"single_blank_line_at_eof":true,"single_class_element_per_statement":{"elements":["property"]},"single_import_per_statement":true,"single_line_after_imports":true,"switch_case_semicolon_to_colon":true,"switch_case_space":true,"visibility_required":true,"encoding":true,"full_opening_tag":true},"hashes":{"CreateControllerCommand.php":-1682517708}}

src/Commands/CreateControllerCommand.php

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -611,7 +611,6 @@ protected function getUploadFileMethod(array $fields, $withFormRequest)
611611
*/
612612
protected function getDestenationFile($name, $path)
613613
{
614-
615614
if (!empty($path)) {
616615
$path = Helpers::getPathWithSlash(ucfirst($path));
617616
}
@@ -629,7 +628,9 @@ protected function getDestenationFile($name, $path)
629628
*/
630629
protected function getRequestsNamespace($name, $path)
631630
{
632-
$path = str_finish($path, '\\');
631+
if (!empty($path)) {
632+
$path = str_finish($path, '\\');
633+
}
633634

634635
$path = $this->getAppNamespace() . Config::getRequestsPath($path);
635636

@@ -700,8 +701,10 @@ protected function makeFormRequest($input)
700701
*/
701702
protected function getModelNamespace($modelName, $modelDirectory)
702703
{
703-
$modelDirectory = str_finish($modelDirectory, '\\');
704-
704+
if (!empty($modelDirectory)) {
705+
$modelDirectory = str_finish($modelDirectory, '\\');
706+
}
707+
705708
$namespace = $this->getAppNamespace() . Config::getModelsPath($modelDirectory . $modelName);
706709

707710
return rtrim(Helpers::convertSlashToBackslash($namespace), '\\');
@@ -733,9 +736,9 @@ protected function getCommandInput()
733736
$extends = $this->generatorOption('controller-extends');
734737
$withAuth = $this->option('with-auth');
735738

736-
return (object) compact('formRequestDirectory','viewDirectory', 'viewName', 'modelName', 'prefix', 'perPage', 'fileSnippet', 'modelDirectory',
739+
return (object) compact('formRequestDirectory', 'viewDirectory', 'viewName', 'modelName', 'prefix', 'perPage', 'fileSnippet', 'modelDirectory',
737740
'langFile', 'fields', 'withFormRequest', 'formRequestName', 'force', 'fieldsFile', 'template',
738-
'controllerName', 'extends', 'withAuth','controllerDirectory');
741+
'controllerName', 'extends', 'withAuth', 'controllerDirectory');
739742
}
740743

741744
/**

src/Commands/CreateMappedResourcesCommand.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ class CreateMappedResourcesCommand extends Command
3636
{--table-exists : This option will attempt to fetch the field from existing database table.}
3737
{--primary-key=id : The name of the primary key.}
3838
{--translation-for= : A comma seperated string of languages to create fields for.}
39+
{--form-request-directory= : The directory of the form-request.}
3940
{--mapping-filename= : The name of the resource mapping file.}
4041
{--force : This option will override the controller if one already exists.}';
4142

src/Commands/CreateMigrationCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -831,7 +831,7 @@ protected function getCommandInput()
831831
$modelName = trim($this->argument('model-name'));
832832
$madeUpTableName = $this->makeTableName($modelName);
833833
$tableName = trim($this->option('table-name')) ?: $madeUpTableName;
834-
$className = trim($this->option('migration-class-name')) ?: sprintf('Create%sTable', $madeUpTableName);
834+
$className = trim($this->option('migration-class-name')) ?: sprintf('Create%sTable', studly_case($madeUpTableName));
835835
$connection = trim($this->option('connection-name'));
836836
$engine = trim($this->option('engine-name'));
837837
$fields = trim($this->option('fields'));

0 commit comments

Comments
 (0)