diff --git a/CHANGELOG.md b/CHANGELOG.md index f10a84b..9856258 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,7 +10,7 @@ - The `create:routes` command now has a new option `without-route-clause` which will create the routes without `there` clause for the id. It may be used when the primary key is not an integer. Additionally, the options `--for-api` and `--api-version` have been added to add support for created api-based routes. - added command to create api-resource with/without collection when using Laravel 5.5+. - The `create:api-scaffold` command have been added to allow you to create resources for the api. - - The user is no longer required to publish the default templates. This is much better step to prevent upgrade braking when the template are updated during a patch release. The user should publish templates only if he/she want to modify it and rename it. **IMPORTANT** Delete existing default and default-collective templates from the folders from the default publish path of your project. + - The user is no longer required to publish the default templates. This is much better step to prevent upgrade braking when the template are updated during a patch release. The user should publish templates only if he/she want to modify it and rename it. **IMPORTANT** Delete existing `default` templates from the folders from the default publish path of your project. - The user no longer have to publish resource to install the package! One line only is required to install the package on laravel 5.5+ (i.e, composer require crestapps/laravel-code-generator --dev) - **IMPORTANT**: delete the the `codegenerator.php` file from your config folder, then rename the `codegenerator_custom.php` file to `laravel-code-generator.php`. Alternatively, you can delete both `codegenerator.php` and `codegenerator_custom.php` - Added `--model-extends` option to the create:model command to allow the use to extend a custom default base class. diff --git a/README.md b/README.md index 5f959e3..4bfe8ca 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ An intelligent code generator for Laravel framework that will save you time! Thi For full documentation and live demo please visit CrestApps.com -**Note: ** The available documentation is for versions <= 2.2. The documentation for vertion 2.3+ is very similar with some exceptions. Please review the Change Log to get a list of the changes. +**Note: ** The available documentation is for versions <= 2.2. The documentation for version 2.3+ is very similar with some exceptions. Please review the Change Log to get a list of the changes. ## Features @@ -22,7 +22,7 @@ For full documentation and live demo please visit Client-side validation.
  • File uploading handling.
  • Auto store multiple-response in the database.
  • -
  • Create form-request to clean up your controller and increase your code reusability.
  • +
  • Create form-request to clean up your controller and increase your code re-usability.
  • Create view's layouts with and without client-side validation.
  • Change the template at run time to generate different views.
  • Ability to generate views with and without Laravel-Collective.
  • -
  • Nicely handles any date, time or datetime field.
  • +
  • Nicely handles any date, time or DateTime field.
  • Auto handles any boolean field.
  • Very easy to use with lots of documentation.
  • ## Installation -1. To download this package into your laravel project, use the command-line to execute the following command +1. To download this package into your Laravel project, use the command-line to execute the following command ``` composer require crestapps/laravel-code-generator --dev @@ -53,7 +53,7 @@ For full documentation and live demo please visit
    A layout is required for the default views! The code generator allows you to create a layout using the command-line. Of cource you can use your own layout. You'll only need to include [CSS bootstrap framework](http://getbootstrap.com/ "CSS bootstrap framework") in your layout for the default templates to work properly. Additionally, you can chose to you design your own templetes using a different or no css framework. +> A layout is required for the default views! The code generator allows you to create a layout using the command-line. Of course you can use your own layout. You'll only need to include [CSS bootstrap framework](http://getbootstrap.com/ "CSS bootstrap framework") in your layout for the default templates to work properly. Additionally, you can chose to you design your own templates using a different or no css framework. ## Lessons Checkout our channel on YouTube.com @@ -93,6 +93,12 @@ Checkout our channel on MIT license - diff --git a/config/default.php b/config/default.php index 659e5e3..a7f9556 100644 --- a/config/default.php +++ b/config/default.php @@ -30,20 +30,6 @@ */ 'templates_path' => 'resources/laravel-code-generator/templates', - /* - |-------------------------------------------------------------------------- - | Array of templates that should be generated with Laravel-Collective. - |-------------------------------------------------------------------------- - | - | If you want to generate code by using laravel-collective, you must first - | install the package. Then add the tamplate name that should be using - | Laravel-Collective extensions when generating code. - | - */ - 'laravel_collective_templates' => [ - 'default-collective', - ], - /* |-------------------------------------------------------------------------- | The default path of where the uploaded files live. @@ -59,7 +45,7 @@ /* |-------------------------------------------------------------------------- - | The default output format for datetime fields. + | The default output format for DateTime fields. |-------------------------------------------------------------------------- | | This output format can also be changed at the field level using the @@ -70,10 +56,10 @@ /* |-------------------------------------------------------------------------- - | The default path of where the json resource-files are located. + | The default path of where the JSON resource-files are located. |-------------------------------------------------------------------------- | - | In this path, you can create json file to import the resources from. + | In this path, you can create JSON file to import the resources from. | */ 'resource_file_path' => 'resources/laravel-code-generator/sources', @@ -161,7 +147,7 @@ |-------------------------------------------------------------------------- | */ - 'api_docs_controller_path' => 'Http/Controllers/ApiDocs', + 'api_docs_controller_path' => 'Http/Controllers', /* |-------------------------------------------------------------------------- @@ -231,15 +217,15 @@ /* |-------------------------------------------------------------------------- - | Patterns to use to generate the html placeholders. + | Patterns to use to generate the HTML placeholders. |-------------------------------------------------------------------------- | | When creating the fields, the code generator follows a pattern to generate - | placeholders for the html code. Here you can define which html-types should + | placeholders for the HTML code. Here you can define which html-types should | the generator create placeholder for. Also, you can define how would you like | the text to read when no placeholder is assigned. | - | The follwowing templates can be used to. assuming the field name is owner_name + | The following templates can be used to. assuming the field name is owner_name | [% field_name %] <=> "owner name" | [% field_name_sentence %] <=> "Owner name" | [% field_name_plural %] <=> "owner names" @@ -268,11 +254,11 @@ | Key phrases that are will be used to determine if a field should have a relation. |-------------------------------------------------------------------------- | - | When creating resources from existing database, the codegenerator scans - | the field's name for a mattching pattern. When found, these field are considered + | When creating resources from existing database, the code generator scans + | the field's name for a matching pattern. When found, these field are considered | foreign keys even when the database does not have a foreign constraints. | Here you can specify patterns to help the generator understand your - | database naming convension. + | database naming conversion. | */ 'common_key_patterns' => [ @@ -338,10 +324,23 @@ ], ], [ - 'match' => ['picture', 'file', 'photo', 'avatar'], + 'match' => ['picture', 'photo', 'avatar', 'image'], + 'set' => [ + 'is-on-index' => false, + 'html-type' => 'file', + 'data-type' => 'string', + 'data-type-params' => [255], + 'validation' => 'image', + ], + ], + [ + 'match' => ['file', 'document', 'attachment*'], 'set' => [ 'is-on-index' => false, 'html-type' => 'file', + 'data-type' => 'string', + 'data-type-params' => [255], + 'validation' => 'file', ], ], [ @@ -373,7 +372,7 @@ ], ], [ - 'match' => ['created_at', 'updated_at', 'deleted_at'], + 'match' => ['created_at', 'updated_at', 'deleted_at', 'modified_at'], 'set' => [ 'data-type' => 'datetime', 'is-on-form' => false, @@ -464,7 +463,7 @@ /* |-------------------------------------------------------------------------- - | A string to postfix the api-resource name with. + | A string to post fix the api-resource name with. |-------------------------------------------------------------------------- | | If you don't like to post fix the api-resource with "Resource" you can @@ -475,7 +474,7 @@ /* |-------------------------------------------------------------------------- - | A string to postfix the collection-api-resource name with. + | A string to post fix the collection-api-resource name with. |-------------------------------------------------------------------------- | | If you don't like to post fix the collection-api-resource with "Collection" @@ -495,7 +494,7 @@ /* |-------------------------------------------------------------------------- - | A string to postfix the form-request name with. + | A string to post fix the form-request name with. |-------------------------------------------------------------------------- | | If you don't like to post fix the form-request with "FormRequest" you can @@ -506,7 +505,7 @@ /* |-------------------------------------------------------------------------- - | Defining non-english or irregular plurals + | Defining non-English or irregular plurals |-------------------------------------------------------------------------- | | The code-generator heavily uses Laravel helpers "str_plural()" @@ -533,10 +532,9 @@ | The "key" of the array is the value to be used in the locale files. | The "text" key of the sub array, is the string to display in the view or add to the locale files. | The "template" key of the sub array, is the string to be use in the view for replacement. - | The "in-function-with-collective" key of the sub array, tell the generator that, | this string would be used in a function or not. | - | The follwowing templates can be used. Assuming the model name is AssetCategory + | The following templates can be used. Assuming the model name is AssetCategory | [% model_name %] <=> "asset category" | [% model_name_sentence %] <=> "Asset category" | [% model_name_plural %] <=> "asset categories" @@ -570,7 +568,6 @@ 'delete' => [ 'text' => 'Delete [% model_name_title %]', 'template' => 'delete_model', - 'in-function-with-collective' => true, ], 'edit' => [ 'text' => 'Edit [% model_name_title %]', @@ -587,17 +584,14 @@ 'add' => [ 'text' => 'Add', 'template' => 'add', - 'in-function-with-collective' => true, ], 'update' => [ 'text' => 'Update', 'template' => 'update', - 'in-function-with-collective' => true, ], 'confirm_delete' => [ 'text' => 'Click Ok to delete [% model_name_title %].', 'template' => 'confirm_delete', - 'in-function-with-collective' => true, ], 'none_available' => [ 'text' => 'No [% model_name_plural_title %] Available.', @@ -658,7 +652,7 @@ 'template' => 'this_parameter_is_an_http_header', ], 'request_was_successful' => [ - 'text' => 'Request was successfull.', + 'text' => 'Request was successfully.', 'template' => 'request_was_successful', ], 'boolean_title' => [ @@ -807,7 +801,7 @@ | Here you can define labels to be used when creating the api-documentation. | You can define how would you like the text to be generated. | - | The follwowing templates can be used. Assuming the model name is AssetCategory + | The following templates can be used. Assuming the model name is AssetCategory | [% model_name %] <=> "asset category" | [% model_name_sentence %] <=> "Asset category" | [% model_name_plural %] <=> "asset categories" @@ -840,12 +834,12 @@ 'the_total_of_available_pages' => 'The total of the available pages.', 'store_route_description' => 'Create new [% model_name %].', 'store_route_response_description' => 'The API\'s response will be JSON based data. The JSON object will be structured as follow', - 'update_route_description' => 'Update existsing [% model_name %].', + 'update_route_description' => 'Update existing [% model_name %].', 'update_route_response_description' => 'The API\'s response will be JSON based data. The JSON object will be structured as follow', - 'show_route_description' => 'Retrieve existsing [% model_name %].', + 'show_route_description' => 'Retrieve existing [% model_name %].', 'show_route_response_description' => 'The API\'s response will be JSON based data. The JSON object will be structured as follow', 'the_id_of_model_to_retrieve' => 'The unique id of the [% model_name %] to retrieve', - 'destroy_route_description' => 'Delete existsing [% model_name %].', + 'destroy_route_description' => 'Delete existing [% model_name %].', 'destroy_route_response_description' => 'The API\'s response will be JSON based data. The JSON object will be structured as follow', 'the_id_of_model_to_delete' => 'The id of the [% model_name %] to delete.', 'general_description' => 'Allows you to list, create, edit, show and delete [% model_name_plural %].', @@ -929,7 +923,7 @@ | Eloquent method to html-type mapping. |-------------------------------------------------------------------------- | - | This is the mapping used to convert database-column into html field + | This is the mapping used to convert database-column into HTML field | */ 'eloquent_type_to_html_type' => [ diff --git a/config/laravel-code-generator.php b/config/laravel-code-generator.php index a71cbbd..4eccd9a 100644 --- a/config/laravel-code-generator.php +++ b/config/laravel-code-generator.php @@ -7,14 +7,14 @@ | CodeGenerator config overrides |-------------------------------------------------------------------------- | - | It is a good idea to sperate your configuration form the code-generator's + | It is a good idea to separate your configuration form the code-generator's | own configuration. This way you won't lose any settings/preference | you have when upgrading to a new version of the package. | | Additionally, you will always know any the configuration difference between | the default config than your own. | - | To override the setting that is found in the codegenerator.php file, you'll + | To override the setting that is found in the 'config/default.php' file, you'll | need to create identical key here with a different value | | IMPORTANT: When overriding an option that is an array, the configurations diff --git a/src/CodeGeneratorServiceProvider.php b/src/CodeGeneratorServiceProvider.php index c884823..d6f52ca 100644 --- a/src/CodeGeneratorServiceProvider.php +++ b/src/CodeGeneratorServiceProvider.php @@ -26,11 +26,6 @@ public function boot() $this->publishes([ $dir . 'templates/default' => $this->codeGeneratorBase('templates/default'), ], 'default-template'); - - // publish the defaultcollective-template - $this->publishes([ - $dir . 'templates/default-collective' => $this->codeGeneratorBase('templates/default-collective'), - ], 'default-collective-template'); } /** @@ -69,7 +64,7 @@ public function register() 'CrestApps\CodeGenerator\Commands\ApiDocs\CreateApiDocsControllerCommand', 'CrestApps\CodeGenerator\Commands\ApiDocs\CreateApiDocsScaffoldCommand', 'CrestApps\CodeGenerator\Commands\ApiDocs\CreateApiDocsViewCommand', - 'CrestApps\CodeGenerator\Commands\Resources\ResourceFileFromDatabaseAllCommand' + 'CrestApps\CodeGenerator\Commands\Resources\ResourceFileFromDatabaseAllCommand' ]; if (Helpers::isNewerThanOrEqualTo()) { diff --git a/src/Commands/Api/CreateApiControllerCommand.php b/src/Commands/Api/CreateApiControllerCommand.php index f2ae243..7b1261f 100644 --- a/src/Commands/Api/CreateApiControllerCommand.php +++ b/src/Commands/Api/CreateApiControllerCommand.php @@ -28,7 +28,7 @@ class CreateApiControllerCommand extends ControllerCommandBase */ protected $signature = 'create:api-controller {model-name : The model name that this controller will represent.} - {--controller-name= : The name of the controler.} + {--controller-name= : The name of the controller.} {--controller-directory= : The directory where the controller should be created under.} {--model-directory= : The path where the model should be created under.} {--resource-file= : The name of the resource-file to import from.} @@ -37,7 +37,7 @@ class CreateApiControllerCommand extends ControllerCommandBase {--language-filename= : The languages file name to put the labels in.} {--with-form-request : This will extract the validation into a request form class.} {--without-form-request : Generate the controller without the form-request file. } - {--with-auth : Generate the controller with Laravel auth middlewear. } + {--with-auth : Generate the controller with Laravel authentication middleware. } {--template-name= : The template name to use when generating the code.} {--form-request-directory= : The directory of the form-request.} {--controller-extends=default-controller : The base controller to be extend.} @@ -46,7 +46,7 @@ class CreateApiControllerCommand extends ControllerCommandBase {--api-resource-collection-directory= : The directory where the api-resource-collection should be created.} {--api-resource-name= : The api-resource file name.} {--api-resource-collection-name= : The api-resource-collection file name.} - {--api-version= : The api version to prefix your resurces with.} + {--api-version= : The api version to prefix your resources with.} {--force : This option will override the controller if one already exists.}'; /** @@ -74,7 +74,7 @@ public function handle() if ($input->withApiResource) { if (!Helpers::isApiResourceSupported()) { - $this->info('Api-resource is not supported in the current Laravel version. To use Api-resource, pleae upgrade to Laravel 5.5+.'); + $this->info('Api-resource is not supported in the current Laravel version. To use Api-resource, please upgrade to Laravel 5.5+.'); $this->warn('*** Continuing without create api-resource! ***'); } else { $this->makeApiResource($input, false) @@ -162,7 +162,7 @@ protected function getAdditionalNamespaces($input) protected function getNamespacesForUsedRelations(array $fields) { // Since there is no create/edit forms in the API controller, - // No need for any relation's namespances. + // No need for any relation's namespaces. return []; } @@ -267,7 +267,7 @@ protected function getSuccessCall($modelName, array $fields, $method) { $stub = $this->getStubContent('api-controller-call-' . $method . '-success-method'); - $viewLabels = new ViewLabelsGenerator($modelName, $fields, $this->isCollectiveTemplate()); + $viewLabels = new ViewLabelsGenerator($modelName, $fields); $this->replaceModelName($stub, $modelName) ->replaceStandardLabels($stub, $viewLabels->getLabels()) @@ -289,7 +289,7 @@ protected function getApiResourceCall($modelName, $fields, $method) { $stub = $this->getStubContent('api-controller-call-' . $method . '-api-resource'); - $viewLabels = new ViewLabelsGenerator($modelName, $fields, $this->isCollectiveTemplate()); + $viewLabels = new ViewLabelsGenerator($modelName, $fields); $this->replaceModelName($stub, $modelName) ->replaceStandardLabels($stub, $viewLabels->getLabels()) @@ -498,6 +498,9 @@ protected function getCommandInput() { $input = parent::getCommandInput(); + $cName = trim($this->option('controller-name')); + $input->controllerName = $cName ? Str::finish($cName, Config::getControllerNamePostFix()) : Helpers::makeApiControllerName($modelName); + $input->apiResourceDirectory = trim($this->option('api-resource-directory')); $input->apiResourceCollectionDirectory = trim($this->option('api-resource-collection-directory')); $input->apiResourceName = trim($this->option('api-resource-name')); diff --git a/src/Commands/Api/CreateApiResourceCommand.php b/src/Commands/Api/CreateApiResourceCommand.php index 53284b6..fc327e3 100644 --- a/src/Commands/Api/CreateApiResourceCommand.php +++ b/src/Commands/Api/CreateApiResourceCommand.php @@ -37,8 +37,7 @@ class CreateApiResourceCommand extends Command {--api-resource-collection-name= : The api-resource-collection file name.} {--model-directory= : The path where the model should be created under.} {--template-name= : The template name to use when generating the code.} - {--collection : Create a resource collection.} - {--api-version= : The api version to prefix your resurces with.} + {--api-version= : The api version to prefix your resources with.} {--force : Override the model if one already exists.}'; /** @@ -58,22 +57,22 @@ public function handle() $input = $this->getCommandInput(); $resource = Resource::fromFile($input->resourceFile, 'CrestApps'); - $apiResourceFileName = $this->getApiFileName($input->modelName, $input->isCollection); + $apiResourceFileName = $this->getApiFileName($input->modelName); - $destenationFile = $this->getDestenationFile($apiResourceFileName, $input->isCollection); + $destenationFile = $this->getDestenationFile($apiResourceFileName); - if ($this->hasErrors($resource, $destenationFile, $input->isCollection)) { + if ($this->hasErrors($resource, $destenationFile)) { return false; } - $stub = $this->getStubContent($this->getFileTitle($input->isCollection)); - $viewLabels = new ViewLabelsGenerator($input->modelName, $resource->fields, $this->isCollectiveTemplate()); + $stub = $this->getStubContent($this->getFileTitle()); + $viewLabels = new ViewLabelsGenerator($input->modelName, $resource->fields); - return $this->replaceNamespace($stub, $this->getClassNamepace($input->isCollection)) - ->replaceModelApiArray($stub, $this->getModelApiArray($resource->fields, $input->modelName, $input->isCollection)) + return $this->replaceNamespace($stub, $this->getClassNamepace()) + ->replaceModelApiArray($stub, $this->getModelApiArray($resource->fields, $input->modelName)) ->replaceApiResourceClass($stub, $apiResourceFileName) ->replaceApiResourceCollectionClass($stub, $this->getApiResourceCollectionClassName($input->modelName)) - ->replaceTransformMethod($stub, $this->getTransformMethod($input, $resource->fields, $input->isCollection, $input->isCollection)) + ->replaceTransformMethod($stub, $this->getTransformMethod($input, $resource->fields)) ->replaceStandardLabels($stub, $viewLabels->getLabels()) ->replaceModelName($stub, $input->modelName) ->replaceModelFullname($stub, self::getModelNamespace($input->modelName, $input->modelDirectory)) @@ -82,35 +81,24 @@ public function handle() } /** - * Gets the namespace for the api class. - * - * @param bool $isCollection + * Gets the namespace for the API class. * * @return string */ - protected function getClassNamepace($isCollection) + protected function getClassNamepace() { - if ($isCollection) { - return $this->getApiResourceCollectionNamespace(); - } - return $this->getApiResourceNamespace(); } /** - * Gets the file name for the api class. + * Gets the file name for the API class. * * @param string $modelName - * @param bool $isCollection * * @return string */ - protected function getApiFileName($modelName, $isCollection) + protected function getApiFileName($modelName) { - if ($isCollection) { - return $this->getApiResourceCollectionClassName($modelName); - } - return $this->getApiResourceClassName($modelName); } @@ -123,10 +111,10 @@ protected function getApiFileName($modelName, $isCollection) * * @return bool */ - protected function hasErrors(Resource $resource, $destenationFile, $isCollection) + protected function hasErrors(Resource $resource, $destenationFile) { $hasErrors = false; - $title = $this->getFileTitle($isCollection); + $title = $this->getFileTitle(); if ($resource->isProtected($title)) { $this->warn('The ' . $title . ' is protected and cannot be regenerated. To regenerate the file, unprotect it from the resource-file.'); @@ -144,22 +132,15 @@ protected function hasErrors(Resource $resource, $destenationFile, $isCollection } /** - * Gets the destenation file to be created. + * Gets the destination file to be created. * * @param string $name - * @param bool $isCollection * * @return string */ - protected function getDestenationFile($name, $isCollection = false) - { - if ($isCollection) { - $path = $this->getApiResourceCollectionPath(); - } else { - $path = $this->getApiResourcePath(); - } - - $path = Str::trimStart($path, Helpers::getAppNamespace()); + protected function getDestenationFile($name) + { + $path = Str::trimStart($this->getApiResourcePath(), Helpers::getAppNamespace()); return app_path($path . $name . '.php'); } @@ -174,7 +155,6 @@ protected function getCommandInput() $modelName = trim($this->argument('model-name')); $resourceFile = trim($this->option('resource-file')) ?: Helpers::makeJsonFileName($modelName); $template = $this->getTemplateName(); - $isCollection = $this->option('collection'); $modelDirectory = trim($this->option('model-directory')); $apiVersion = trim($this->option('api-version')); @@ -182,7 +162,6 @@ protected function getCommandInput() 'modelName', 'resourceFile', 'template', - 'isCollection', 'modelDirectory' ); } diff --git a/src/Commands/Api/CreateApiScaffoldCommand.php b/src/Commands/Api/CreateApiScaffoldCommand.php index 4fcd620..2368326 100644 --- a/src/Commands/Api/CreateApiScaffoldCommand.php +++ b/src/Commands/Api/CreateApiScaffoldCommand.php @@ -22,7 +22,7 @@ class CreateApiScaffoldCommand extends CreateScaffoldCommandBase */ protected $signature = 'create:api-scaffold {model-name : The model name that this resource will represent.} - {--controller-name= : The name of the controler.} + {--controller-name= : The name of the controller.} {--controller-directory= : The directory where the controller should be created under. } {--controller-extends=default-controller : The base controller to be extend.} {--model-directory= : The path of the model.} @@ -34,10 +34,10 @@ class CreateApiScaffoldCommand extends CreateScaffoldCommandBase {--models-per-page=25 : The amount of models per page for index pages.} {--language-filename= : The languages file name to put the labels in.} {--with-form-request : This will extract the validation into a request form class.} - {--with-auth : Generate the controller with Laravel auth middlewear. } + {--with-auth : Generate the controller with Laravel authentication middleware. } {--table-name= : The name of the table.} {--primary-key=id : The name of the primary key.} - {--with-soft-delete : Enables softdelete future should be enable in the model.} + {--with-soft-delete : Enables soft-delete future should be enable in the model.} {--without-languages : Generate the resource without the language files. } {--without-model : Generate the resource without the model file. } {--without-controller : Generate the resource without the controller file. } @@ -49,13 +49,13 @@ class CreateApiScaffoldCommand extends CreateScaffoldCommandBase {--engine-name= : A specific engine name.} {--template-name= : The template name to use when generating the code.} {--table-exists : This option will attempt to fetch the field from existing database table.} - {--translation-for= : A comma seperated string of languages to create fields for.} + {--translation-for= : A comma separated string of languages to create fields for.} {--with-api-resource : Generate the controller with both api-resource and api-resource-collection classes.} {--with-api-docs : Create full api documentation.} {--api-resource-directory= : The directory where the api-resource should be created.} {--api-resource-collection-directory= : The directory where the api-resource-collection should be created.} {--api-resource-name= : The api-resource file name.} - {--api-version= : The api version to prefix your resurces with.} + {--api-version= : The api version to prefix your resources with.} {--api-resource-collection-name= : The api-resource-collection file name.} {--force : This option will override the controller if one already exists.}'; @@ -193,7 +193,7 @@ protected function createRoutes(ApiScaffoldInput $input, Field $primaryField = n } /** - * Get the Api folder after removing the controllers path. + * Get the API folder after removing the controllers path. * * @param string $path * @@ -222,6 +222,9 @@ protected function getCommandInput() { $input = new ApiScaffoldInput(parent::getCommandInput()); + $cName = trim($this->option('controller-name')); + + $input->controllerName = $cName ? Str::finish($cName, Config::getControllerNamePostFix()) : Helpers::makeApiControllerName($input->modelName); $input->withApiResource = $this->option('with-api-resource'); $input->apiResourceDirectory = $this->option('api-resource-directory'); $input->apiResourceCollectionDirectory = $this->option('api-resource-collection-directory'); diff --git a/src/Commands/ApiDocs/CreateApiDocsControllerCommand.php b/src/Commands/ApiDocs/CreateApiDocsControllerCommand.php index 843ef56..1af1c67 100644 --- a/src/Commands/ApiDocs/CreateApiDocsControllerCommand.php +++ b/src/Commands/ApiDocs/CreateApiDocsControllerCommand.php @@ -35,16 +35,16 @@ class CreateApiDocsControllerCommand extends ControllerCommandBase */ protected $signature = 'api-docs:create-controller {model-name : The model name that this controller will represent.} - {--controller-name= : The name of the controler.} + {--controller-name= : The name of the controller.} {--controller-directory= : The directory where the controller should be created under.} {--views-directory= : The path where the views should be created under.} {--resource-file= : The name of the resource-file to import from.} {--routes-prefix=default-form : Prefix of the route group.} {--language-filename= : The languages file name to put the labels in.} - {--with-auth : Generate the controller with Laravel auth middlewear. } + {--with-auth : Generate the controller with Laravel authentication middlewere. } {--template-name= : The template name to use when generating the code.} {--controller-extends=default-controller : The base controller to be extend.} - {--api-version= : The api version to prefix your resurces with.} + {--api-version= : The api version to prefix your resources with.} {--force : This option will override the controller if one already exists.}'; /** @@ -199,7 +199,7 @@ protected function getControllerDirectory($controllerDirectory) } /** - * Gets the destenation file to be created. + * Gets the destination file to be created. * * @param string $name * @param string $path @@ -262,7 +262,7 @@ protected function getCommandInput() { $modelName = trim($this->argument('model-name')); $cName = trim($this->option('controller-name')); - $controllerName = $cName ? Str::finish($cName, Config::getControllerNamePostFix()) : Helpers::makeControllerName($modelName); + $controllerName = $cName ? Str::finish($cName, Config::getControllerNamePostFix()) : Helpers::makeApiDocsControllerName($modelName); $prefix = ($this->option('routes-prefix') == 'default-form') ? Helpers::makeRouteGroup($modelName) : $this->option('routes-prefix'); $resourceFile = trim($this->option('resource-file')) ?: Helpers::makeJsonFileName($modelName); $force = $this->option('force'); diff --git a/src/Commands/ApiDocs/CreateApiDocsScaffoldCommand.php b/src/Commands/ApiDocs/CreateApiDocsScaffoldCommand.php index bc13713..24c76b4 100644 --- a/src/Commands/ApiDocs/CreateApiDocsScaffoldCommand.php +++ b/src/Commands/ApiDocs/CreateApiDocsScaffoldCommand.php @@ -7,10 +7,12 @@ use CrestApps\CodeGenerator\Traits\CommonCommand; use CrestApps\CodeGenerator\Traits\ScaffoldTrait; use Illuminate\Console\Command; +use CrestApps\CodeGenerator\Support\Helpers; +use CrestApps\CodeGenerator\Traits\LanguageTrait; class CreateApiDocsScaffoldCommand extends command { - use ApiDocViewsTrait, CommonCommand, ScaffoldTrait; + use ApiDocViewsTrait, CommonCommand, ScaffoldTrait, LanguageTrait; /** * The console command description. @@ -33,16 +35,16 @@ class CreateApiDocsScaffoldCommand extends command */ protected $signature = 'api-docs:scaffold {model-name : The model name that this controller will represent.} - {--controller-name= : The name of the controler.} + {--controller-name= : The name of the controller.} {--controller-directory= : The directory where the controller should be created under.} {--views-directory= : The path where the views should be created under.} {--resource-file= : The name of the resource-file to import from.} {--routes-prefix=default-form : Prefix of the route group.} {--language-filename= : The languages file name to put the labels in.} - {--with-auth : Generate the controller with Laravel auth middlewear. } + {--with-auth : Generate the controller with Laravel authentication middleware. } {--template-name= : The template name to use when generating the code.} {--controller-extends=default-controller : The base controller to be extend.} - {--api-version= : The api version to prefix your resurces with.} + {--api-version= : The api version to prefix your resources with.} {--force : This option will override the controller if one already exists.}'; /** @@ -143,7 +145,7 @@ protected function createRoutes($input) } /** - * Executes the command that generates the lanaguage entries. + * Executes the command that generates the language entries. * * @param object $input * @@ -169,7 +171,8 @@ protected function createLanguageFile($input) protected function getCommandInput() { $modelName = $this->argument('model-name'); - $controllerName = $this->option('controller-name'); + $cName = trim($this->option('controller-name')); + $controllerName = $cName ? Str::finish($cName, Config::getControllerNamePostFix()) : Helpers::makeApiDocsControllerName($modelName . 'ApiDocs'); $prefix = $this->option('routes-prefix'); $resourceFile = $this->option('resource-file'); $force = $this->option('force'); diff --git a/src/Commands/ApiDocs/CreateApiDocsViewCommand.php b/src/Commands/ApiDocs/CreateApiDocsViewCommand.php index 27da053..ab2b798 100644 --- a/src/Commands/ApiDocs/CreateApiDocsViewCommand.php +++ b/src/Commands/ApiDocs/CreateApiDocsViewCommand.php @@ -26,7 +26,7 @@ class CreateApiDocsViewCommand extends Command * * @var string */ - protected $description = 'Create view to render the api-documenations.'; + protected $description = 'Create view to render the api-documentations.'; /** * The name and signature of the console command. @@ -35,15 +35,15 @@ class CreateApiDocsViewCommand extends Command */ protected $signature = 'api-docs:create-view {model-name : The model name that this controller will represent.} - {--controller-name= : The name of the controler.} + {--controller-name= : The name of the controller.} {--controller-directory= : The directory where the controller should be created under.} {--resource-file= : The name of the resource-file to import from.} {--routes-prefix=default-form : Prefix of the route group.} {--language-filename= : The languages file name to put the labels in.} - {--with-auth : Generate the controller with Laravel auth middlewear. } + {--with-auth : Generate the controller with Laravel authentication middleware. } {--views-directory= : The name of the directory to create the views under.} - {--api-version= : The api version to prefix your resurces with.} - {--layout-name=layouts.api-doc-layout : This will extract the validation into a request form class.} + {--api-version= : The api version to prefix your resources with.} + {--layout-name=layouts.app : This will extract the validation into a request form class.} {--template-name= : The template name to use when generating the code.} {--force : This option will override the controller if one already exists.}'; @@ -64,7 +64,7 @@ public function handle() $stub = $this->getStubContent('api-documentation-index'); - $viewLabels = new ViewLabelsGenerator($input->modelName, $resource->fields, $this->isCollectiveTemplate()); + $viewLabels = new ViewLabelsGenerator($input->modelName, $resource->fields); // The replaceAuthorizedRequestForIndex() method must be executed before replaceAuthorizationCall() return $this->replaceAuthorizedRequestForIndex($stub, $this->getAuthorizedRequestForIndex($input->withAuth, $resource->getApiDocLabels(), $viewLabels->getLabels())) @@ -121,7 +121,7 @@ protected function getFailedAuthorizationCall($withAuth) } /** - * It gets the views destenation path + * It gets the views destination path * * @param $viewsDirectory * @@ -205,7 +205,7 @@ protected function makeStandardSubView($name, $input, array $apiDocLabels, array } /** - * Gets the destenation file to be created. + * Gets the destination file to be created. * * @param string $name * @param string $path @@ -346,7 +346,7 @@ protected function getValidationRules(Field $field) } /** - * It generate the destenation view name + * It generate the destination view name * * @param $action * @@ -370,7 +370,7 @@ protected function hasErrors(Resource $resource, $destenationFile) $hasErrors = false; if ($resource->isProtected('api-documentation')) { - $this->warn('The api-documentation is protected and cannot be regenerated. To regenerate the file, unprotect it from the resource file.'); + $this->warn('The api-documentation is protected and cannot be regenerated. To regenerate the file, unprotected it from the resource file.'); $hasErrors = true; } @@ -548,7 +548,7 @@ protected function getCommandInput() { $modelName = trim($this->argument('model-name')); $cName = trim($this->option('controller-name')); - $controllerName = $cName ? Str::finish($cName, Config::getControllerNamePostFix()) : Helpers::makeControllerName($modelName); + $controllerName = $cName ? Str::finish($cName, Config::getControllerNamePostFix()) : Helpers::makeApiDocsControllerName($modelName); $controllerDirectory = trim($this->option('controller-directory')); $viewsDirectory = trim($this->option('views-directory')); $layoutName = trim($this->option('layout-name')); diff --git a/src/Commands/Bases/ControllerCommandBase.php b/src/Commands/Bases/ControllerCommandBase.php index 0f75c83..bbfaef0 100644 --- a/src/Commands/Bases/ControllerCommandBase.php +++ b/src/Commands/Bases/ControllerCommandBase.php @@ -289,7 +289,7 @@ protected function getConstructor($withAuth) } /** - * Gets name of the middleware + * Gets name of the middleware. * * @return string */ @@ -316,7 +316,7 @@ protected function getControllerExtends($namespace) } /** - * Gets the controllers namespace + * Gets the controllers namespace. * * @param string $path * @@ -330,7 +330,7 @@ protected function getControllersNamespace($path) } /** - * Gets the destenation file to be created. + * Gets the destination file to be created. * * @param string $name * @param string $path @@ -349,7 +349,7 @@ protected function getDestenationFile($name, $path) } /** - * Gets the full class name to extend + * Gets the full class name to extend. * * @return string */ @@ -369,7 +369,7 @@ protected function getFullClassToExtend() } /** - * Gets the default class name to extend + * Gets the default class name to extend. * * @param string $extend * @@ -438,7 +438,7 @@ protected function getOnUpdateAction(array $fields) } /** - * Gets the relation accessor for the given foreign renationship. + * Gets the relation accessor for the given foreign relationship. * * @param CrestApps\CodeGenerator\Models\ForeignRelationship $collection * @@ -675,7 +675,7 @@ protected function makeFormRequest($input) } /** - * Replaces the auth middleware + * Replaces the authentication middleware. * * @param string $stub * @param string $middleware @@ -701,10 +701,10 @@ protected function replaceCallDataMethod(&$stub, $code) } /** - * Replaces the auth contructor + * Replaces the auth constructor * * @param string $stub - * @param string $contructor + * @param string $constructor * * @return $this */ @@ -805,7 +805,7 @@ protected function replaceRelationCollections(&$stub, $collections) } /** - * Replace sthe form-request's fullname for the given stub. + * Replaces the form-request's full name for the given stub. * * @param string $stub * @param string $name @@ -844,7 +844,7 @@ protected function replaceRequestVariable(&$stub, $variable) } /** - * It Replaces the templates of the givin $labels + * It Replaces the templates of the given $labels * * @param string $stub * @param array $items @@ -917,7 +917,7 @@ protected function processCommonTasks($input, $resource, &$stub) $dataMethod = $this->getDataMethod($resource->fields, $this->requestNameSpace . '\\' . $this->requestName, $input); $languages = array_keys(self::getLanguageItems($resource->fields)); - $viewLabels = new ViewLabelsGenerator($input->modelName, $resource->fields, $this->isCollectiveTemplate()); + $viewLabels = new ViewLabelsGenerator($input->modelName, $resource->fields); $namespacesToUse = $this->getRequiredUseClasses($resource->fields, $this->getAdditionalNamespaces($input)); return $this->replaceGetDataMethod($stub, $dataMethod) @@ -945,7 +945,7 @@ protected function processCommonTasks($input, $resource, &$stub) } /** - * Gets any additional classes to include in the use statement + * Gets any additional classes to include in the use statement. * * @param object $input * @@ -1002,7 +1002,7 @@ protected function getControllerStubName() } /** - * Gets the path to controllers + * Gets the path to controllers. * * @param string $file * @@ -1011,7 +1011,7 @@ protected function getControllerStubName() abstract protected function getControllerPath($file = ''); /** - * Gets the type of the controller + * Gets the type of the controller. * * @return string */ diff --git a/src/Commands/Bases/ControllerRequestCommandBase.php b/src/Commands/Bases/ControllerRequestCommandBase.php index 6f8b628..f6e2161 100644 --- a/src/Commands/Bases/ControllerRequestCommandBase.php +++ b/src/Commands/Bases/ControllerRequestCommandBase.php @@ -50,7 +50,7 @@ protected function getFillables(array $fields) } /** - * Gets laravel ready field validation format from a given string + * Gets Laravel ready field validation format from a given string * * @param array $fields * @@ -81,7 +81,7 @@ protected function getValidationRules(array $fields) } /** - * Gets laravel ready field validation format for a given field + * Gets Laravel ready field validation format for a given field * * @param CrestApps\CodeGenerator\Models\Field $field * @param string $customRules @@ -167,7 +167,7 @@ protected function extractCustomValidationRules(array $rules) } /** - * Checks if the givin rule is a custom validation rule + * Checks if the given rule is a custom validation rule * * @param string $rule * @@ -205,7 +205,7 @@ protected function getCustomRuleShortName($rule) } /** - * Checks if a class name starts with a slash \ + * Checks if a class name starts with a slash \. * * @param string $fullname * @@ -217,7 +217,7 @@ protected function canHaveUsingCommand($fullname) } /** - * Get the full class name of the given custom valiation rule. + * Get the full class name of the given custom validation rule. * * @param string $rule * @@ -347,7 +347,7 @@ protected function getStringToNullSnippet(array $fields) } /** - * Gets the method's stub that handels the file uploading. + * Gets the method's stub that handles the file uploading. * * @param array $fields * @param string $baseClass @@ -412,7 +412,7 @@ protected function replaceFileValidationSnippet(&$stub, $snippet) } /** - * Replaces the fillable snippet for the given stub. + * Replaces the fallible snippet for the given stub. * * @param string $fillable * diff --git a/src/Commands/Bases/ResourceFileCommandBase.php b/src/Commands/Bases/ResourceFileCommandBase.php index c029390..39d51bc 100644 --- a/src/Commands/Bases/ResourceFileCommandBase.php +++ b/src/Commands/Bases/ResourceFileCommandBase.php @@ -25,7 +25,7 @@ protected function getResources($file, array $languages = []) } /** - * Gets the destenation filename. + * Gets the destination filename. * * @param string $name * diff --git a/src/Commands/Bases/ViewsCommandBase.php b/src/Commands/Bases/ViewsCommandBase.php index c9e228c..3c9c92b 100644 --- a/src/Commands/Bases/ViewsCommandBase.php +++ b/src/Commands/Bases/ViewsCommandBase.php @@ -63,7 +63,7 @@ protected function getViewName() } /** - * It gets the views destenation path + * It gets the views destination path * * @param $viewsDirectory * @@ -119,7 +119,7 @@ protected function getDestinationViewFullname($viewsDirectory, $routesPrefix, $v } /** - * It generate the destenation view name + * It generate the destination view name * * @param $action * @@ -138,9 +138,9 @@ protected function getDestinationViewName($action) * * @return $this */ - protected function replaceCommonTemplates(&$stub, ViewInput $input, array $fields) + protected function replaceCommonTemplates(&$stub, $input, array $fields) { - $viewLabels = new ViewLabelsGenerator($input->modelName, $fields, $this->isCollectiveTemplate()); + $viewLabels = new ViewLabelsGenerator($input->modelName, $fields); $standardLabels = $viewLabels->getLabels(); @@ -222,7 +222,7 @@ protected function replaceFormName(&$stub, $name) /** * Get the view's name of a given file. * - * @param string $fillname + * @param string $filename * * @return string */ @@ -270,10 +270,6 @@ protected function replaceFileUpload(&$stub, array $fields) */ protected function getFileUploadAttribute($template) { - if ($this->isCollectiveTemplate($template)) { - return "'files' => true,"; - } - return ' enctype="multipart/form-data"'; } @@ -309,7 +305,7 @@ protected function getViewCommand($view) } /** - * It checks of a destination view exists or not + * It checks of a destination view exists or not. * * @param string $viewsDirectory * @param string $routesPrefix @@ -325,7 +321,7 @@ protected function isViewExists($viewsDirectory, $routesPrefix, $viewName) } /** - * It called tha create-locale command to generate the locale config + * It calls the create-locale command to generate the locale config * * @param string $langFile * @param string $fields @@ -347,7 +343,7 @@ protected function createLanguageFile($langFile, $resourceFile, $modelName) } /** - * Gets destenation view path + * Gets destination view path * * @param string $viewsDirectory * @param string $routesPrefix @@ -395,7 +391,7 @@ protected function getHeaderFieldAccessor(array $fields, $modelName) } /** - * Gets a new instance of the proper html generator. + * Gets a new instance of the proper HTML generator. * * @param array $fields * @param string $modelName @@ -405,15 +401,11 @@ protected function getHeaderFieldAccessor(array $fields, $modelName) */ protected function getHtmlGenerator(array $fields, $modelName, $template) { - if ($this->isCollectiveTemplate($template)) { - return new LaravelCollectiveHtml($fields, $modelName, $template); - } - return new StandardHtml($fields, $modelName, $template); } /** - * Replace the modele's header fo the given stub. + * Replace the model's header for the given stub. * * @param string $stub * @param string $title diff --git a/src/Commands/Framework/CreateControllerCommand.php b/src/Commands/Framework/CreateControllerCommand.php index 1a56ec4..2d510e2 100644 --- a/src/Commands/Framework/CreateControllerCommand.php +++ b/src/Commands/Framework/CreateControllerCommand.php @@ -23,7 +23,7 @@ class CreateControllerCommand extends ControllerCommandBase */ protected $signature = 'create:controller {model-name : The model name that this controller will represent.} - {--controller-name= : The name of the controler.} + {--controller-name= : The name of the controller.} {--controller-directory= : The directory where the controller should be created under.} {--model-directory= : The path where the model should be created under.} {--views-directory= : The path where the views should be created under.} @@ -33,7 +33,7 @@ class CreateControllerCommand extends ControllerCommandBase {--language-filename= : The languages file name to put the labels in.} {--with-form-request : This will extract the validation into a request form class.} {--without-form-request : Generate the controller without the form-request file. } - {--with-auth : Generate the controller with Laravel auth middlewear. } + {--with-auth : Generate the controller with Laravel authentication middleware. } {--template-name= : The template name to use when generating the code.} {--form-request-directory= : The directory of the form-request.} {--controller-extends=default-controller : The base controller to be extend.} diff --git a/src/Commands/Framework/CreateFormRequestCommand.php b/src/Commands/Framework/CreateFormRequestCommand.php index 0bacb31..53a9e11 100644 --- a/src/Commands/Framework/CreateFormRequestCommand.php +++ b/src/Commands/Framework/CreateFormRequestCommand.php @@ -21,7 +21,7 @@ class CreateFormRequestCommand extends ControllerRequestCommandBase {--resource-file= : The name of the resource-file to import from.} {--routes-prefix=default-form : Prefix of the route group.} {--template-name= : The template name to use when generating the code.} - {--with-auth : Generate the form-request with Laravel auth middlewear. } + {--with-auth : Generate the form-request with Laravel authentication middleware. } {--form-request-directory= : The directory of the form-request.} {--force : This option will override the form-request if one already exists.}'; @@ -119,7 +119,7 @@ protected function getDataMethod(array $fields) } /** - * Gets the boolean value that the autherize() method will return. + * Gets the boolean value that the authorize() method will return. * * @param array $fields * @@ -176,7 +176,7 @@ protected function isConvertEmptyStringsToNullRegistered() } /** - * Gets the destenation's fullname + * Gets the destination's full name. * * @param string $name * @param string $path @@ -189,7 +189,7 @@ protected function getDestenationFile($name, $path) } /** - * Gets the Requests namespace + * Gets the Requests namespace. * * @param string $path * diff --git a/src/Commands/Framework/CreateLanguageCommand.php b/src/Commands/Framework/CreateLanguageCommand.php index 67d3587..5b60d4e 100644 --- a/src/Commands/Framework/CreateLanguageCommand.php +++ b/src/Commands/Framework/CreateLanguageCommand.php @@ -66,7 +66,7 @@ public function handle() } /** - * Gets the destenation file. + * Gets the destination file. * * @param CrestApps\CodeGenerator\Models\Resource $resource * @param string $modelName @@ -83,7 +83,7 @@ protected function getAvailableLabels(Resource $resource, $modelName) $languages[$lang] = array_merge($current, $docLabels); } - $viewLabels = new ViewLabelsGenerator($modelName, $resource->fields, $this->isCollectiveTemplate()); + $viewLabels = new ViewLabelsGenerator($modelName, $resource->fields); $standardLabels = $viewLabels->getTranslatedLabels(array_keys($languages)); //Merge the standard labels to the fields label @@ -95,7 +95,7 @@ protected function getAvailableLabels(Resource $resource, $modelName) } /** - * Gets the destenation file. + * Gets the destination file. * * @param array $path * @param string $name @@ -127,7 +127,7 @@ protected function registerMessages(array $messages, $language) } /** - * Checks if a languge has a key int he in-memory collection. + * Checks if a language has a key int he in-memory collection. * * @param string $key * @param string $language @@ -299,7 +299,7 @@ protected function getMessage(Label $label) } /** - * Replace the messages fo the given stub. + * Replace the messages from the given stub. * * @param string $stub * @param string $messages diff --git a/src/Commands/Framework/CreateMappedResourcesCommand.php b/src/Commands/Framework/CreateMappedResourcesCommand.php index 6629404..4489a31 100644 --- a/src/Commands/Framework/CreateMappedResourcesCommand.php +++ b/src/Commands/Framework/CreateMappedResourcesCommand.php @@ -26,11 +26,11 @@ class CreateMappedResourcesCommand extends Command {--models-per-page=25 : The amount of models per page for index pages.} {--language-filename= : The languages file name to put the labels in.} {--table-name= : The name of the table.} - {--controller-name= : The name of the controler.} + {--controller-name= : The name of the controller.} {--with-form-request : This will extract the validation into a request form class.} - {--with-auth : Generate the controller with Laravel auth middlewear. } + {--with-auth : Generate the controller with Laravel authentication middleware. } {--with-migration : Prevent creating a migration for this resource.} - {--with-soft-delete : Enables softdelete future should be enable in the model.} + {--with-soft-delete : Enables soft-delete future should be enable in the model.} {--without-timestamps : Prevent Eloquent from maintaining both created_at and the updated_at properties.} {--without-languages : Generate the resource without the language files. } {--without-model : Generate the resource without the model file. } @@ -44,7 +44,7 @@ class CreateMappedResourcesCommand extends Command {--table-exists : This option will attempt to fetch the field from existing database table.} {--routes-prefix=default-form : Prefix of the route group.} {--primary-key=id : The name of the primary key.} - {--translation-for= : A comma seperated string of languages to create fields for.} + {--translation-for= : A comma separated string of languages to create fields for.} {--form-request-directory= : The directory of the form-request.} {--mapping-filename= : The name of the resource mapping file.} {--force : This option will override the controller if one already exists.}'; @@ -195,7 +195,7 @@ protected function getMappingFile() } /** - * Gets the value of a property of a givig object if exists. + * Gets the value of a property of a given object if exists. * * @param object $object * @param string $name diff --git a/src/Commands/Framework/CreateMigrationCommand.php b/src/Commands/Framework/CreateMigrationCommand.php index 346f14d..df9eadf 100644 --- a/src/Commands/Framework/CreateMigrationCommand.php +++ b/src/Commands/Framework/CreateMigrationCommand.php @@ -38,7 +38,7 @@ class CreateMigrationCommand extends MigrationCommandBase {--resource-file= : The name of the resource-file to import from.} {--template-name= : The template name to use when generating the code.} {--without-timestamps : Prevent Eloquent from maintaining both created_at and the updated_at properties.} - {--with-soft-delete : Enables softdelete future should be enable in the model.} + {--with-soft-delete : Enables soft-delete future should be enable in the model.} {--force : This option will override the migration if one already exists.}'; /** @@ -197,7 +197,7 @@ protected function getMigrationCapsule(MigrationInput $input, $resource, $name, } /** - * Gets migration fullname + * Gets migration full name. * * @param string $name * @param string $tableName @@ -329,7 +329,7 @@ protected function addForeignConstraints(&$properties, array $constraints) } /** - * Gets Foreign contstrains from given fields. + * Gets Foreign constrains from given fields. * * @param array of CrestApps\CodeGenerator\Models\Field $field * @@ -573,7 +573,7 @@ protected function getMethodParamerters(Field $field) } /** - * Constructs the second parameter to the enum type method + * Constructs the second parameter to the Enum type method * * @param CrestApps\CodeGenerator\Models\Field $field * @@ -632,7 +632,7 @@ protected function getPropertyBase($method) } /** - * Creates a leading space to keep the lines alligned the same in the output file. + * Creates a leading space to keep the lines aligned the same in the output file. * * @param int $multiplier * @param bool $prependNewline @@ -1141,7 +1141,7 @@ protected function addPrimaryField(&$property, Field $field = null) } /** - * Adds 'updated_at' and 'created_at' columns to a given propery. + * Adds 'updated_at' and 'created_at' columns to a given property. * * @param string $property * @param bool $without @@ -1159,7 +1159,7 @@ protected function addTimestamps(&$property, $without = false) } /** - * Adds 'delete_at' columns to a given propery. + * Adds 'delete_at' columns to a given property. * * @param string $property * @param bool $withSoftDelete diff --git a/src/Commands/Framework/CreateModelCommand.php b/src/Commands/Framework/CreateModelCommand.php index 077834f..ae29807 100644 --- a/src/Commands/Framework/CreateModelCommand.php +++ b/src/Commands/Framework/CreateModelCommand.php @@ -38,7 +38,7 @@ class CreateModelCommand extends Command {--resource-file= : The name of the resource-file to import from.} {--language-filename= : The languages file name to put the labels in.} {--model-directory= : The directory where the model should be created.} - {--with-soft-delete : Enables softdelete future should be enable in the model.} + {--with-soft-delete : Enables soft-delete future should be enable in the model.} {--without-timestamps : Prevent Eloquent from maintaining both created_at and the updated_at properties.} {--template-name= : The template name to use when generating the code.} {--model-extends=default-model : The base model to be extend.} @@ -131,7 +131,7 @@ protected function hasErrors(Resource $resource, $destenationFile) } /** - * Gets the destenation file to be created. + * Gets the destination file to be created. * * @param string $name * @param string $path @@ -473,13 +473,13 @@ protected function getRelationMethods(array $relations, array $fields) /** * Wraps each non-empty item in an array with single quote. * - * @param array $arrguments + * @param array $arguments * * @return string */ - protected function joinArguments(array $arrguments) + protected function joinArguments(array $arguments) { - return implode(',', Arr::wrapItems(Arr::removeEmptyItems($arrguments))); + return implode(',', Arr::wrapItems(Arr::removeEmptyItems($arguments))); } /** @@ -875,7 +875,7 @@ protected function replacePrimaryKey(&$stub, $primaryKey) } /** - * Replaces the replationships for the given stub. + * Replaces the relationships for the given stub. * * @param $stub * @param array $relationMethods @@ -888,7 +888,7 @@ protected function replaceRelationshipPlaceholder(&$stub, array $relationMethods } /** - * Replaces the replation type for the given stub. + * Replaces the relation type for the given stub. * * @param string $stub * @param string $type @@ -901,7 +901,7 @@ protected function replaceRelationType(&$stub, $type) } /** - * Replaces the replation name for the given stub. + * Replaces the relation name for the given stub. * * @param string $stub * @param string $name @@ -914,7 +914,7 @@ protected function replaceRelationName(&$stub, $name) } /** - * Replaces the replation params for the given stub. + * Replaces the relation parameters for the given stub. * * @param string $stub * @param string $params diff --git a/src/Commands/Framework/CreateResourcesCommand.php b/src/Commands/Framework/CreateResourcesCommand.php index 717d060..e592276 100644 --- a/src/Commands/Framework/CreateResourcesCommand.php +++ b/src/Commands/Framework/CreateResourcesCommand.php @@ -16,7 +16,7 @@ class CreateResourcesCommand extends Command */ protected $signature = 'create:resources {model-name : The model name that this resource will represent.} - {--controller-name= : The name of the controler.} + {--controller-name= : The name of the controller.} {--controller-directory= : The directory where the controller should be created under. } {--controller-extends=default-controller : The base controller to be extend.} {--model-directory= : The path of the model.} @@ -28,10 +28,10 @@ class CreateResourcesCommand extends Command {--models-per-page=25 : The amount of models per page for index pages.} {--language-filename= : The languages file name to put the labels in.} {--with-form-request : This will extract the validation into a request form class.} - {--with-auth : Generate the controller with Laravel auth middlewear. } + {--with-auth : Generate the controller with Laravel authentication middleware. } {--table-name= : The name of the table.} {--primary-key=id : The name of the primary key.} - {--with-soft-delete : Enables softdelete future should be enable in the model.} + {--with-soft-delete : Enables soft-delete future should be enable in the model.} {--without-languages : Generate the resource without the language files. } {--without-model : Generate the resource without the model file. } {--without-controller : Generate the resource without the controller file. } @@ -45,7 +45,7 @@ class CreateResourcesCommand extends Command {--layout-name=layouts.app : This will extract the validation into a request form class.} {--template-name= : The template name to use when generating the code.} {--table-exists : This option will attempt to fetch the field from existing database table.} - {--translation-for= : A comma seperated string of languages to create fields for.} + {--translation-for= : A comma separated string of languages to create fields for.} {--force : This option will override the controller if one already exists.}'; /** @@ -72,7 +72,7 @@ public function handle() } /** - * Get a commbined array of arguments and callable options. + * Get a combined array of arguments and callable options. * * @return array */ diff --git a/src/Commands/Framework/CreateRoutesCommand.php b/src/Commands/Framework/CreateRoutesCommand.php index c8bbda6..781a160 100644 --- a/src/Commands/Framework/CreateRoutesCommand.php +++ b/src/Commands/Framework/CreateRoutesCommand.php @@ -28,7 +28,7 @@ class CreateRoutesCommand extends Command {--controller-directory= : The directory where the controller is under.} {--without-route-clause : Create the routes without where clause for the id.} {--routes-type= : The type of the route to create. (i.e., "api", "api-docs" or "web".)} - {--api-version= : The api version to prefix your resurces with.} + {--api-version= : The api version to prefix your resources with.} {--template-name= : The template name to use when generating the code.}'; /** diff --git a/src/Commands/Framework/CreateScaffoldCommand.php b/src/Commands/Framework/CreateScaffoldCommand.php index bf05f12..1748b3c 100644 --- a/src/Commands/Framework/CreateScaffoldCommand.php +++ b/src/Commands/Framework/CreateScaffoldCommand.php @@ -16,7 +16,7 @@ class CreateScaffoldCommand extends CreateScaffoldCommandBase */ protected $signature = 'create:scaffold {model-name : The model name that this resource will represent.} - {--controller-name= : The name of the controler.} + {--controller-name= : The name of the controller.} {--controller-directory= : The directory where the controller should be created under. } {--controller-extends=default-controller : The base controller to be extend.} {--model-directory= : The path of the model.} @@ -29,10 +29,10 @@ class CreateScaffoldCommand extends CreateScaffoldCommandBase {--models-per-page=25 : The amount of models per page for index pages.} {--language-filename= : The languages file name to put the labels in.} {--with-form-request : This will extract the validation into a request form class.} - {--with-auth : Generate the controller with Laravel auth middlewear. } + {--with-auth : Generate the controller with Laravel authentication middleware. } {--table-name= : The name of the table.} {--primary-key=id : The name of the primary key.} - {--with-soft-delete : Enables softdelete future should be enable in the model.} + {--with-soft-delete : Enables soft-delete future should be enable in the model.} {--without-languages : Generate the resource without the language files. } {--without-model : Generate the resource without the model file. } {--without-controller : Generate the resource without the controller file. } @@ -46,7 +46,7 @@ class CreateScaffoldCommand extends CreateScaffoldCommandBase {--layout-name=layouts.app : This will extract the validation into a request form class.} {--template-name= : The template name to use when generating the code.} {--table-exists : This option will attempt to fetch the field from existing database table.} - {--translation-for= : A comma seperated string of languages to create fields for.} + {--translation-for= : A comma separated string of languages to create fields for.} {--force : This option will override the controller if one already exists.}'; /** diff --git a/src/Commands/Resources/ResourceFileAppendCommand.php b/src/Commands/Resources/ResourceFileAppendCommand.php index 843f886..fb4e802 100644 --- a/src/Commands/Resources/ResourceFileAppendCommand.php +++ b/src/Commands/Resources/ResourceFileAppendCommand.php @@ -19,10 +19,10 @@ class ResourceFileAppendCommand extends ResourceFileCreatorCommandBase protected $signature = 'resource-file:append {model-name : The model name that these files represent.} {--resource-filename= : The destination file name to append too.} - {--fields= : A comma seperate field names.} - {--indexes= : A comma seperated index string.} - {--relations= : A comma seperated realtion string.} - {--translation-for= : A comma seperated string of languages to create fields for.}'; + {--fields= : A comma separate field names.} + {--indexes= : A comma separated index string.} + {--relations= : A comma separated relation string.} + {--translation-for= : A comma separated string of languages to create fields for.}'; /** * The console command description. diff --git a/src/Commands/Resources/ResourceFileCreateCommand.php b/src/Commands/Resources/ResourceFileCreateCommand.php index 2af7b08..12ce15c 100644 --- a/src/Commands/Resources/ResourceFileCreateCommand.php +++ b/src/Commands/Resources/ResourceFileCreateCommand.php @@ -24,10 +24,10 @@ class ResourceFileCreateCommand extends ResourceFileCreatorCommandBase protected $signature = 'resource-file:create {model-name : The model name that these files represent.} {--resource-filename= : The destination file name to append too.} - {--fields= : A comma seperate field names.} - {--indexes= : A comma seperated index string.} - {--relations= : A comma seperated realtion string.} - {--translation-for= : A comma seperated string of languages to create fields for.} + {--fields= : A comma separate field names.} + {--indexes= : A comma separated index string.} + {--relations= : A comma separated relation string.} + {--translation-for= : A comma separated string of languages to create fields for.} {--force : Override existing file if one exists.}'; /** * The console command description. diff --git a/src/Commands/Resources/ResourceFileFromDatabaseCommand.php b/src/Commands/Resources/ResourceFileFromDatabaseCommand.php index d539c8a..7a043ad 100644 --- a/src/Commands/Resources/ResourceFileFromDatabaseCommand.php +++ b/src/Commands/Resources/ResourceFileFromDatabaseCommand.php @@ -33,7 +33,7 @@ class ResourceFileFromDatabaseCommand extends ResourceFileCommandBase {--table-name= : The database table name to fetch the field from.} {--database-name= : The database name the table is stored in.} {--resource-filename= : The destination file name to create.} - {--translation-for= : A comma seperated string of languages to create fields for.} + {--translation-for= : A comma separated string of languages to create fields for.} {--force : This option will override the view if one already exists.}'; /** @@ -149,7 +149,7 @@ protected function isForce() } /** - * Gets the destenation filename. + * Gets the destination filename. * * @return string */ @@ -191,7 +191,7 @@ protected function getTableName() } /** - * Gets the languages to create lang keys for. + * Gets the languages to create language keys for. * * @return array */ @@ -201,7 +201,7 @@ protected function getLanguages() } /** - * Gets migration fullname + * Gets migration full name. * * @param string $name * diff --git a/src/Commands/Resources/ResourceFileReduceCommand.php b/src/Commands/Resources/ResourceFileReduceCommand.php index 7957a47..5a30381 100644 --- a/src/Commands/Resources/ResourceFileReduceCommand.php +++ b/src/Commands/Resources/ResourceFileReduceCommand.php @@ -17,9 +17,9 @@ class ResourceFileReduceCommand extends ResourceFileCommandBase protected $signature = 'resource-file:reduce {model-name : The model name that these files represent.} {--resource-filename= : The destination file name to reduce.} - {--fields= : A comma seperate field names.} - {--indexes= : A comma seperated index string.} - {--relations= : A comma seperated realtion string.}'; + {--fields= : A comma separate field names.} + {--indexes= : A comma separated index string.} + {--relations= : A comma separated relation string.}'; /** * The console command description. diff --git a/src/Commands/Resources/ResourceFileRefreshCommand.php b/src/Commands/Resources/ResourceFileRefreshCommand.php index 4b568ab..a82d257 100644 --- a/src/Commands/Resources/ResourceFileRefreshCommand.php +++ b/src/Commands/Resources/ResourceFileRefreshCommand.php @@ -21,7 +21,7 @@ class ResourceFileRefreshCommand extends ResourceFileCommandBase protected $signature = 'resource-file:refresh {model-name : The model name that these files represent.} {--resource-filename= : The destination file name to append too.} - {--translation-for= : A comma seperated string of languages to create fields for.}'; + {--translation-for= : A comma separated string of languages to create fields for.}'; /** * The console command description. * diff --git a/src/Commands/Views/CreateCreateViewCommand.php b/src/Commands/Views/CreateCreateViewCommand.php index 7d9cc75..a451779 100644 --- a/src/Commands/Views/CreateCreateViewCommand.php +++ b/src/Commands/Views/CreateCreateViewCommand.php @@ -48,6 +48,7 @@ protected function getStubName() protected function handleCreateView() { $input = $this->getCommandInput(); + $resources = Resource::fromFile($input->resourceFile, $input->languageFileName); $destenationFile = $this->getDestinationViewFullname($input->viewsDirectory, $input->prefix); @@ -68,7 +69,7 @@ protected function handleCreateView() } /** - * Gets te create form name + * Gets the create form name * * @param string $modelName * @@ -80,7 +81,7 @@ protected function getFormName($modelName) } /** - * Gets te create form id + * Gets the create form id * * @param string $modelName * diff --git a/src/Commands/Views/CreateEditViewCommand.php b/src/Commands/Views/CreateEditViewCommand.php index a98718f..1090fad 100644 --- a/src/Commands/Views/CreateEditViewCommand.php +++ b/src/Commands/Views/CreateEditViewCommand.php @@ -68,7 +68,7 @@ protected function handleCreateView() } /** - * Gets te create form name + * Gets the create form name. * * @param string $modelName * @@ -80,7 +80,7 @@ protected function getFormName($modelName) } /** - * Gets te create form id + * Gets the create form id. * * @param string $modelName * diff --git a/src/Commands/Views/CreateFormViewCommand.php b/src/Commands/Views/CreateFormViewCommand.php index b2d2ef5..f07e285 100644 --- a/src/Commands/Views/CreateFormViewCommand.php +++ b/src/Commands/Views/CreateFormViewCommand.php @@ -48,6 +48,7 @@ protected function handleCreateView() { $input = $this->getCommandInput(); $resources = Resource::fromFile($input->resourceFile, $input->languageFileName); + $destenationFile = $this->getDestinationViewFullname($input->viewsDirectory, $input->prefix); if ($this->canCreateView($destenationFile, $input->force, $resources)) { @@ -65,7 +66,7 @@ protected function handleCreateView() } /** - * Replaces the form field's html code in a given stub. + * Replaces the form field's HTML code in a given stub. * * @param string $stub * @param string $fields diff --git a/src/Commands/Views/CreateIndexViewCommand.php b/src/Commands/Views/CreateIndexViewCommand.php index a58cde1..983ebe8 100644 --- a/src/Commands/Views/CreateIndexViewCommand.php +++ b/src/Commands/Views/CreateIndexViewCommand.php @@ -4,9 +4,13 @@ use CrestApps\CodeGenerator\Commands\Bases\ViewsCommandBase; use CrestApps\CodeGenerator\Models\Resource; +use CrestApps\CodeGenerator\Support\Helpers; +use CrestApps\CodeGenerator\Traits\LanguageTrait; class CreateIndexViewCommand extends ViewsCommandBase { + use LanguageTrait; + /** * The name and signature of the console command. * @@ -19,6 +23,7 @@ class CreateIndexViewCommand extends ViewsCommandBase {--routes-prefix=default-form : Prefix of the route group.} {--language-filename= : The name of the language file.} {--layout-name=layouts.app : This will extract the validation into a request form class.} + {--pagination-view-name=pagination : the name of the view to use for pagination.} {--template-name= : The template name to use when generating the code.} {--force : This option will override the view if one already exists.}'; @@ -47,9 +52,19 @@ protected function getStubName() protected function handleCreateView() { $input = $this->getCommandInput(); + $resources = Resource::fromFile($input->resourceFile, $input->languageFileName); $destenationFile = $this->getDestinationViewFullname($input->viewsDirectory, $input->prefix); + $paginationFileName = $this->getDestinationViewFullname($input->viewsDirectory, '', $input->paginationViewName); + + if(!$this->alreadyExists($paginationFileName)) + { + $pagerStub = $this->getStubContent('pagination.blade', $this->getTemplateName()); + + $this->createFile($paginationFileName, $pagerStub); + } + if ($this->canCreateView($destenationFile, $input->force, $resources)) { $stub = $this->getStub(); $htmlCreator = $this->getHtmlGenerator($resources->fields, $input->modelName, $this->getTemplateName()); @@ -59,11 +74,58 @@ protected function handleCreateView() ->replaceHeaderCells($stub, $htmlCreator->getIndexHeaderCells()) ->replaceBodyCells($stub, $htmlCreator->getIndexBodyCells()) ->replaceModelHeader($stub, $this->getHeaderFieldAccessor($resources->fields, $input->modelName)) + ->replacePaginationViewName($stub, $input->paginationViewName) ->createFile($destenationFile, $stub) ->info('Index view was crafted successfully.'); } } + /** + * Replaces the fillable for the given stub. + * + * @param string $stub + * @param string $fillable + * + * @return $this + */ + protected function replacePaginationViewName(&$stub, $name) + { + return $this->replaceTemplate('pagination_view_name', $name, $stub); + } + + /** + * Gets a clean user inputs. + * + * @return object + */ + protected function getCommandInput() + { + $options = $this->options(); + + $modelName = trim($this->arguments()['model-name']); + $resourceFile = trim($options['resource-file']) ?: Helpers::makeJsonFileName($modelName); + $viewsDirectory = trim($options['views-directory']); + $prefix = trim($options['routes-prefix']); + $prefix = ($prefix == 'default-form') ? Helpers::makeRouteGroup($modelName) : $prefix; + $force = $options['force']; + $languageFileName = trim($options['language-filename']) ?: self::makeLocaleGroup($modelName); + $layout = trim($options['layout-name']); + $template = trim($options['template-name']); + $paginationViewName = trim($options['pagination-view-name']); + + return (object) compact( + 'modelName', + 'prefix', + 'force', + 'resourceFile', + 'languageFileName', + 'layout', + 'template', + 'paginationViewName', + 'viewsDirectory' + ); + } + /** * Replaces the column headers in a given stub. * diff --git a/src/Commands/Views/CreateLayoutCommand.php b/src/Commands/Views/CreateLayoutCommand.php index dc9d388..7a168df 100644 --- a/src/Commands/Views/CreateLayoutCommand.php +++ b/src/Commands/Views/CreateLayoutCommand.php @@ -18,9 +18,8 @@ class CreateLayoutCommand extends Command {application-name : The name of your application.} {--layout-filename=app : The layout file name to be created.} {--layout-directory=layouts : The directory of the layouts.} - {--without-validation : This option will create a layout without client-side validation.} {--template-name= : The template name to use when generating the code.} - {--force : Override existsing layout.}'; + {--force : Override existing layout.}'; /** * The console command description. @@ -42,7 +41,6 @@ public function handle() 'application-name' => $this->argument('application-name'), '--layout-filename' => $this->option('layout-filename'), '--layout-directory' => $this->option('layout-directory'), - '--without-validation' => $this->option('without-validation'), '--template-name' => $this->option('template-name'), '--force' => $this->option('force'), ] diff --git a/src/Commands/Views/CreateViewLayoutCommand.php b/src/Commands/Views/CreateViewLayoutCommand.php index 181cc09..6f13324 100644 --- a/src/Commands/Views/CreateViewLayoutCommand.php +++ b/src/Commands/Views/CreateViewLayoutCommand.php @@ -23,9 +23,8 @@ class CreateViewLayoutCommand extends Command {application-name : The name of your application.} {--layout-filename=app : The layout file name to be created.} {--layout-directory=layouts : The directory of the layouts.} - {--without-validation : This option will create a layout without client-side validation.} {--template-name= : The template name to use when generating the code.} - {--force : Override existsing layout.}'; + {--force : Override existing layout.}'; /** * The console command description. @@ -51,8 +50,7 @@ public function handle() return false; } - $stubName = $input->withoutValidation ? 'layout' : 'layout-with-validation'; - $stub = $this->getStubContent($stubName, $this->getTemplateName()); + $stub = $this->getStubContent('layout', $this->getTemplateName()); $this->replaceApplicationName($stub, $input->appName) ->createFile($destenationFile, $stub) @@ -96,7 +94,7 @@ protected function fileExists($filename, $force) } /** - * Gets the destenation path. + * Gets the destination path. * * @param string $path * @@ -121,14 +119,13 @@ protected function getCommandInput() $appName = trim($this->argument('application-name')); $layoutFileName = Str::postfix(trim($this->option('layout-filename')) ?: 'layout-filename', '.blade.php'); $layoutDirectory = trim($this->option('layout-directory')); - $withoutValidation = $this->option('without-validation'); $force = $this->option('force'); - return (object) compact('appName', 'layoutFileName', 'layoutDirectory', 'withoutValidation', 'force'); + return (object) compact('appName', 'layoutFileName', 'layoutDirectory', 'force'); } /** - * Replaces the application'd name fo the given stub. + * Replaces the application's name for the given stub. * * @param string $stub * @param string $appName diff --git a/src/DatabaseParsers/MysqlParser.php b/src/DatabaseParsers/MysqlParser.php index c4abe90..177bfef 100644 --- a/src/DatabaseParsers/MysqlParser.php +++ b/src/DatabaseParsers/MysqlParser.php @@ -241,7 +241,7 @@ protected function getIndexes() } /** - * Gets the field after transfering it from a given query object. + * Gets the field after transferring it from a given query object. * * @param object $column * @@ -292,7 +292,7 @@ protected function getTransfredFields(array $columns) } /** - * Gets the type params + * Gets the type parameters. * * @param string $length * @param string $dataType diff --git a/src/DatabaseParsers/ParserBase.php b/src/DatabaseParsers/ParserBase.php index f29627d..32b3e59 100644 --- a/src/DatabaseParsers/ParserBase.php +++ b/src/DatabaseParsers/ParserBase.php @@ -38,7 +38,7 @@ abstract class ParserBase protected $tableName; /** - * The databasename + * The database name * * @var array */ @@ -143,7 +143,7 @@ public function getResourceAsJson() } /** - * Gets array of field after transfering each column meta into field. + * Gets array of field after transferring each column meta into field. * * @param array $fields * @@ -161,7 +161,7 @@ protected function transfer(array $fields) } /** - * Get the html type for a given field. + * Get the HTML type for a given field. * * @param CrestApps\CodeGenerator\Models\Field $field * @param string $type @@ -180,7 +180,7 @@ protected function getHtmlType($type) } /** - * Set the html type for a given field. + * Set the HTML type for a given field. * * @param CrestApps\CodeGenerator\Models\Field $field * @param string $type diff --git a/src/DatabaseParsers/SqlServerParser.php b/src/DatabaseParsers/SqlServerParser.php index 2dea269..ba24405 100644 --- a/src/DatabaseParsers/SqlServerParser.php +++ b/src/DatabaseParsers/SqlServerParser.php @@ -18,7 +18,7 @@ class SqlServerParser extends ParserBase protected $tableName; /** - * The databasename + * The database name * * @var array */ @@ -103,7 +103,7 @@ protected function getColumn() } /** - * Gets array of field after transfering each column meta into field. + * Gets array of field after transferring each column meta into field. * * @param array $columns * @@ -133,7 +133,7 @@ protected function transfer(array $columns) } /** - * Set the unsiged flag for a given field. + * Set the unsigned flag for a given field. * * @param CrestApps\CodeGenerator\Models\Field $field * @param string $type @@ -151,7 +151,7 @@ protected function setUnsigned(Field &$field, $type) } /** - * Set the html type for a given field. + * Set the HTML type for a given field. * * @param CrestApps\CodeGenerator\Models\Field $field * @param string $type @@ -296,7 +296,7 @@ protected function getLabelName($name) } /** - * Gets the eloquent method to html + * Gets the eloquent method to HTML * * @return array */ diff --git a/src/HtmlGenerators/HtmlGeneratorBase.php b/src/HtmlGenerators/HtmlGeneratorBase.php index e4fcb62..4189ffc 100644 --- a/src/HtmlGenerators/HtmlGeneratorBase.php +++ b/src/HtmlGenerators/HtmlGeneratorBase.php @@ -55,7 +55,7 @@ public function __construct(array $fields, $modelName, $template = null) } /** - * Gets html field for the current set fields. + * Gets HTML field for the current set fields. * * @return string */ @@ -95,8 +95,8 @@ public function getHtmlFields() } /** - * Gets html code for the show view using the current fields colelction. - * If an value is passed, it will only generate the raws based on the given fields + * Gets HTML code for the show view using the current fields collection. + * If an value is passed, it will only generate the rows based on the given fields * * @param array $fields * @@ -117,7 +117,7 @@ public function getShowRowsHtml(array $fields = null) } /** - * Gets show row html code for the given field. + * Gets show row HTML code for the given field. * * @param string $stub * @param CreatApps\Models\Field $field @@ -135,7 +135,7 @@ protected function getShowRowHtmlField($stub, Field $field) } /** - * Gets the value to use in the show view + * Gets the value to use in the show view. * * @param Field $field * @@ -151,8 +151,8 @@ protected function getFieldValueForShow(Field $field) } /** - * Gets header cells' html code for the index view using the current fields colelction. - * If an value is passed, it will only generate the raws based on the given fields + * Gets header cells' HTML code for the index view using the current fields collection. + * If an value is passed, it will only generate the rows based on the given fields * * @param array $fields * @@ -193,8 +193,8 @@ public function replaceCommonTemplates(&$stub, Field $field) } /** - * Gets header body's html code for the index view using the current fields colelction. - * If an value is passed, it will only generate the raws based on the given fields + * Gets header body's HTML code for the index view using the current fields collection. + * If an value is passed, it will only generate the rows based on the given fields * * @param array $fields * @@ -214,7 +214,7 @@ public function getIndexBodyCells(array $fields = null) } /** - * Gets index body cell html code for the given field. + * Gets index body cell HTML code for the given field. * * @param string $stub * @param CreatApps\Models\Field $field @@ -233,7 +233,7 @@ protected function getIndexBodyCell($stub, Field $field) } /** - * Replace the selectedValue fo the given stub. + * Replace the selectedValue for the given stub. * * @param string $stub * @param string $value @@ -248,7 +248,7 @@ protected function replaceSelectedValue(&$stub, $value) } /** - * Replace the checkedItem fo the given stub. + * Replace the checkedItem for the given stub. * * @param string $stub * @param string $value @@ -263,7 +263,7 @@ protected function replaceCheckedItem(&$stub, $value) } /** - * Replace the fieldValue fo the given stub. + * Replace the fieldValue for the given stub. * * @param string $stub * @param string $value @@ -341,7 +341,7 @@ protected function getTextareaHtmlField(Field $field, ValidationParser $parser) } /** - * Gets the html min value. + * Gets the HTML min value. * * @param mix (int|float) $validationMinValue * @param mix (int|float) $fieldMinValue @@ -358,7 +358,7 @@ protected function getHtmlMinValue($validationMinValue, $fieldMinValue) } /** - * Gets the html max value. + * Gets the HTML max value. * * @param mix (int|float) $validationMaxValue * @param mix (int|float) $fieldMaxValue @@ -375,7 +375,7 @@ protected function getHtmlMaxValue($validationMaxValue, $fieldMaxValue) } /** - * Gets creates an checkbox/radio button html field for a given field. + * Gets creates an checkbox/radio button HTML field for a given field. * * @param CrestApps\CodeGeneraotor\Support\Field $field * @param CrestApps\CodeGeneraotor\Support\ValidationParser $parser @@ -405,7 +405,7 @@ protected function getPickItemsHtml(Field $field, ValidationParser $parser) } /** - * Gets creates a checkbox or radio button html field for a given field. + * Gets creates a checkbox or radio button HTML field for a given field. * * @param CrestApps\CodeGeneraotor\Support\Field $field * @param CrestApps\CodeGeneraotor\Support\Label $option @@ -432,7 +432,7 @@ protected function getPickItemsHtmlField(Field $field, Label $option, Validation } /** - * Gets field name ending with square brakets + * Gets field name ending with square brackets * * @param string $name * @@ -444,7 +444,7 @@ protected function getFieldNameAsArray($name) } /** - * Gets creates an select menu html field for a given field. + * Gets creates an select menu HTML field for a given field. * * @param CrestApps\CodeGeneraotor\Support\Field $field * @param CrestApps\CodeGeneraotor\Support\ValidationParser $parser @@ -475,7 +475,7 @@ protected function getSelectHtmlField(Field $field, ValidationParser $parser) } /** - * Gets the fields accessor + * Gets the fields accessor. * * @param CrestApps\CodeGeneraotor\Support\Field $field * @@ -493,7 +493,7 @@ protected function getFieldItem(Field $field) } /** - * Gets the fields item accessor + * Gets the fields item accessor. * * @param CrestApps\CodeGeneraotor\Support\Field $field * @@ -510,7 +510,7 @@ protected function getFieldItemAccessor(Field $field) } /** - * Gets the field value accesor. + * Gets the field value accessor. * * @param CrestApps\CodeGeneraotor\Support\Field $field * @@ -555,7 +555,7 @@ protected function getSelectedValueForMenu(Field $field) } /** - * Gets creates an password html5 field for a given field. + * Gets creates an password HTML5 field for a given field. * * @param CrestApps\CodeGeneraotor\Support\Field $field * @@ -617,7 +617,7 @@ public function getSelectMonthHtmlField(Field $field) } /** - * Gets creates an password html5 field for a given field. + * Gets creates an password HTML5 field for a given field. * * @param CrestApps\CodeGeneraotor\Support\Field $field * @param CrestApps\CodeGeneraotor\Support\ValidationParser $parser @@ -647,7 +647,7 @@ public function getPasswordHtmlField(Field $field, ValidationParser $parser) } /** - * Gets creates an standard html5 field for a given field. + * Gets creates an standard HTML5 field for a given field. * * @param CrestApps\CodeGeneraotor\Support\Field $field * @param CrestApps\CodeGeneraotor\Support\ValidationParser $parser @@ -678,7 +678,7 @@ public function getStandardHtmlField(Field $field, ValidationParser $parser) } /** - * Gets the gretest value of the given parameters. It ignores null or empty string. + * Gets the greatest value of the given parameters. It ignores null or empty string. * * @return numeric */ @@ -731,7 +731,7 @@ protected function wrapField(&$fieldStub, Field $field, $standardLabel = true, $ } /** - * Creates html label from a given field + * Creates HTML label from a given field * * @param CrestApps\CodeGenerator\Models\Field $field * @@ -747,7 +747,7 @@ protected function getLabelFromField(Field $field = null) } /** - * Creates html label. + * Creates HTML label. * * @param string $name * @param CrestApps\CodeGenerator\Models\Label $label @@ -781,7 +781,7 @@ protected function getNewHelper(Field $field) } /** - * Gets the required class arrribute + * Gets the required class attribute * * @param string $class * @@ -843,7 +843,7 @@ protected function getTitle(Label $label, $raw = false) } /** - * Replace the fieldName fo the given stub. + * Replace the fieldName for the given stub. * * @param string $stub * @param string $fieldName @@ -858,7 +858,7 @@ protected function replaceFieldName(&$stub, $fieldName) } /** - * Replace the fieldItem fo the given stub. + * Replace the fieldItem for the given stub. * * @param string $stub * @param string $name @@ -888,7 +888,7 @@ protected function replaceFieldItemAccessor(&$stub, $name) } /** - * Replace the fieldValueAccessor fo the given stub. + * Replace the fieldValueAccessor for the given stub. * * @param string $stub * @param string $name @@ -903,7 +903,7 @@ protected function replaceFieldValueAccessor(&$stub, $name) } /** - * Replace the minValue fo the given stub. + * Replace the minValue for the given stub. * * @param string $stub * @param string $minValue @@ -918,7 +918,7 @@ protected function replaceFieldMinValue(&$stub, $minValue) } /** - * Replace the maxValue fo the given stub. + * Replace the maxValue for the given stub. * * @param string $stub * @param string $maxValue @@ -933,7 +933,7 @@ protected function replaceFieldMaxValue(&$stub, $maxValue) } /** - * Replace the minLength fo the given stub. + * Replace the minLength for the given stub. * * @param string $stub * @param string $minLength @@ -948,7 +948,7 @@ protected function replaceFieldMinLengthName(&$stub, $minLength) } /** - * Replace the maxLength fo the given stub. + * Replace the maxLength for the given stub. * * @param string $stub * @param string $maxLength @@ -963,7 +963,7 @@ protected function replaceFieldMaxLengthName(&$stub, $maxLength) } /** - * Replace the requiredField fo the given stub. + * Replace the requiredField for the given stub. * * @param string $stub * @param string $required @@ -978,7 +978,7 @@ protected function replaceFieldRequired(&$stub, $required) } /** - * Replace the placeholder fo the given stub. + * Replace the placeholder for the given stub. * * @param string $stub * @param string $placeholder @@ -993,7 +993,7 @@ protected function replaceFieldPlaceHolder(&$stub, $placeholder) } /** - * Replace the fieldValue fo the given stub. + * Replace the fieldValue for the given stub. * * @param string $stub * @param string $fieldValue @@ -1008,7 +1008,7 @@ protected function replaceFieldValue(&$stub, $fieldValue) } /** - * Replace the optionValue fo the given stub. + * Replace the optionValue for the given stub. * * @param string $stub * @param string $optionValue @@ -1023,7 +1023,7 @@ protected function replaceOptionValue(&$stub, $optionValue) } /** - * Replace the requiredClass fo the given stub. + * Replace the requiredClass for the given stub. * * @param string $stub * @param string $class @@ -1038,7 +1038,7 @@ protected function replaceRequiredClass(&$stub, $class) } /** - * Replace the itemId fo the given stub. + * Replace the itemId for the given stub. * * @param string $stub * @param string $fieldValue @@ -1053,7 +1053,7 @@ protected function replaceItemId(&$stub, $itemId) } /** - * Replace the itemTitle fo the given stub. + * Replace the itemTitle for the given stub. * * @param string $stub * @param string $itemTitle @@ -1068,7 +1068,7 @@ protected function replaceItemLabel(&$stub, $itemTitle) } /** - * Replace the fieldType fo the given stub. + * Replace the fieldType for the given stub. * * @param string $stub * @param string $fieldType @@ -1083,7 +1083,7 @@ protected function replaceFieldType(&$stub, $fieldType) } /** - * Replace the CssClass fo the given stub. + * Replace the CssClass for the given stub. * * @param string $stub * @param CrestApps\CodeGenerator\Models\Label $label @@ -1099,7 +1099,7 @@ protected function replaceCssClass(&$stub, $class) } /** - * Replace the fieldTitle fo the given stub. + * Replace the fieldTitle for the given stub. * * @param string $stub * @param CrestApps\CodeGenerator\Models\Label $label @@ -1115,7 +1115,7 @@ protected function replaceFieldTitle(&$stub, $title) } /** - * Replace the fieldValidationHelper fo the given stub. + * Replace the fieldValidationHelper for the given stub. * * @param string $stub * @param string $helper @@ -1130,7 +1130,7 @@ protected function replaceFieldValidationHelper(&$stub, $helper) } /** - * Replace the fieldLabel fo the given stub. + * Replace the fieldLabel for the given stub. * * @param string $stub * @param string $fieldLabel @@ -1145,7 +1145,7 @@ protected function replaceFieldLabel(&$stub, $fieldLabel) } /** - * Replace the fieldInput fo the given stub. + * Replace the fieldInput for the given stub. * * @param string $stub * @param string $fieldInput @@ -1205,7 +1205,7 @@ protected function replaceFieldStep(&$stub, $step) } /** - * It gets converts an array to a stringbase array for the views. + * It gets converts an array to a string base array for the views. * * @param CrestApps\CodeGenerator\Models\Field $field * @@ -1351,7 +1351,7 @@ abstract protected function getMultipleCheckedItem($value, $name, $defaultValue) abstract protected function getMultipleSelectedValue($name, $valueAccessor, $defaultValue); /** - * Gets the html steps attribute. + * Gets the HTML steps attribute. * * @param int value * diff --git a/src/HtmlGenerators/LaravelCollectiveHtml.php b/src/HtmlGenerators/LaravelCollectiveHtml.php index 740f8fe..9ea8c46 100644 --- a/src/HtmlGenerators/LaravelCollectiveHtml.php +++ b/src/HtmlGenerators/LaravelCollectiveHtml.php @@ -243,7 +243,7 @@ protected function getMultipleRawOptionValue($name, $value, $defaultValue) } /** - * Gets the best value accessor for the view + * Gets the best value accessor for the view. * * @param string $modelVariable * @param string $property @@ -278,7 +278,7 @@ protected function getMultipleSelectedValue($name, $valueAccessor, $defaultValue } /** - * Gets the html steps attribute. + * Gets the HTML steps attribute. * * @param int value * diff --git a/src/HtmlGenerators/StandardHtml.php b/src/HtmlGenerators/StandardHtml.php index 4445896..55e36a8 100644 --- a/src/HtmlGenerators/StandardHtml.php +++ b/src/HtmlGenerators/StandardHtml.php @@ -117,7 +117,7 @@ protected function getFieldMultiple($isMulti) } /** - * It gets converts an array to a stringbase array for the views. + * It gets converts an array to a string base array for the views. * * @param CrestApps\CodeGenerator\Models\Field $field * @@ -194,7 +194,7 @@ protected function getMultipleCheckedItem($value, $name, $defaultValue) } /** - * Gets the best value accessor for the view + * Gets the best value accessor for the view. * * @param string $modelVariable * @param string $property @@ -295,7 +295,7 @@ protected function getMultipleRawOptionValue($name, $value, $defaultValue) } /** - * Creates html label. + * Creates HTML label. * * @param string $name * @param CrestApps\CodeGenerator\Models\Label $label @@ -313,7 +313,7 @@ protected function getLabelElement($name, Label $label) } /** - * Gets the html steps attribute. + * Gets the HTML steps attribute. * * @param int value * diff --git a/src/Models/ForeignRelationship.php b/src/Models/ForeignRelationship.php index da8fceb..7d6659a 100644 --- a/src/Models/ForeignRelationship.php +++ b/src/Models/ForeignRelationship.php @@ -311,7 +311,7 @@ public function getModelColumns() } if (count($columns) == 0) { - // At this poing we know the column have not yet been identified + // At this point, we know the column have not yet been identified // which also mean that the model does not exists or the table // does not existing in the database. // Try to find the columns from the resource-file if one found. diff --git a/src/Models/IndexMigrationChange.php b/src/Models/IndexMigrationChange.php index 3f77ffd..9492dbf 100644 --- a/src/Models/IndexMigrationChange.php +++ b/src/Models/IndexMigrationChange.php @@ -72,6 +72,7 @@ public static function getDeleted(Index $index) return $change; } + /** * Get the migration change after comparing two given fields * diff --git a/src/Models/Label.php b/src/Models/Label.php index 88301cd..a766e37 100644 --- a/src/Models/Label.php +++ b/src/Models/Label.php @@ -22,7 +22,7 @@ class Label /** * Is the label plain text or not * - * @var vool + * @var bool */ public $isPlain = true; @@ -48,7 +48,7 @@ class Label public $id; /** - * The template to use for replacment. + * The template to use for replacement. * * @var string */ diff --git a/src/Models/MigrationCapsule.php b/src/Models/MigrationCapsule.php index 80df53b..c3ec490 100644 --- a/src/Models/MigrationCapsule.php +++ b/src/Models/MigrationCapsule.php @@ -138,7 +138,7 @@ public function setResource(Resource $resource) } /** - * Gets array of the paramets + * Gets array of the parameters * * @return array */ diff --git a/src/Models/MigrationChangeCapsule.php b/src/Models/MigrationChangeCapsule.php index 62dbdc4..13bcd18 100644 --- a/src/Models/MigrationChangeCapsule.php +++ b/src/Models/MigrationChangeCapsule.php @@ -88,7 +88,7 @@ public function getIndexesWithUpdate() } /** - * Gets array of the paramets + * Gets array of the parameters. * * @return array */ diff --git a/src/Models/MigrationInput.php b/src/Models/MigrationInput.php index 916e20e..73fb776 100644 --- a/src/Models/MigrationInput.php +++ b/src/Models/MigrationInput.php @@ -42,7 +42,7 @@ class MigrationInput public $resourceFile; /** - * The tamplate to use + * The template to use * * @var string */ @@ -80,7 +80,7 @@ public function __construct(array $arguments, array $options = []) } /** - * Gets array of the paramets + * Gets array of the parameters. * * @return array */ diff --git a/src/Models/MigrationTrackerCapsule.php b/src/Models/MigrationTrackerCapsule.php index 08cfbc7..3fc1fe2 100644 --- a/src/Models/MigrationTrackerCapsule.php +++ b/src/Models/MigrationTrackerCapsule.php @@ -92,7 +92,7 @@ public function addMigration(MigrationCapsule $capsule) } /** - * Get the difference between a givin resource and the + * Get the difference between a given resource and the * resource in the current migration * * @param CrestApps\CodeGenerator\Models\Resource $resourceA @@ -302,7 +302,7 @@ protected function deleteFile($file) } /** - * Get the total migratins + * Get the total migrations. * * @return int */ @@ -423,7 +423,7 @@ public function migrationHasTimestamps() } /** - * Gets array of the paramets + * Gets array of the parameters. * * @return array */ diff --git a/src/Models/Resource.php b/src/Models/Resource.php index aab5e9e..2d031ce 100644 --- a/src/Models/Resource.php +++ b/src/Models/Resource.php @@ -474,7 +474,7 @@ protected function getRawApiDocLabels() } /** - * Converts the protection into a json-ready array + * Converts the protection into an array. * * @return array */ @@ -501,7 +501,7 @@ public function getFields() } /** - * Converts the fields into a json-ready array + * Converts the fields into an array. * * @return array */ @@ -513,7 +513,7 @@ public function getFieldsToArray() } /** - * Converts the relations into a json-ready array + * Converts the relations into a an array. * * @return array */ @@ -525,7 +525,7 @@ public function getRelationsToArray() } /** - * Converts the indexes into a json-ready array + * Converts the indexes into a an array. * * @return array */ @@ -537,7 +537,7 @@ public function getIndexesToArray() } /** - * It transfres a given string to a collection of field + * It transfers a given string to a collection of field * * @param string|json $json * @param string $localeGroup @@ -553,7 +553,7 @@ public static function fromFile($filename, $localeGroup, array $languages = []) } /** - * It transfres a given JSON string to a collection of field + * It transfers a given JSON string to a collection of field * * @param string|json $json * @param string $localeGroup @@ -579,7 +579,7 @@ public static function fromJson($json, $localeGroup, array $languages = []) } /** - * It transfres a gving array to a resource + * It transfers a given array to a resource * * @param array $properties * @param string $localeGroup @@ -635,7 +635,7 @@ public static function fromArray(array $properties, $localeGroup, array $languag } /** - * Gets a relation collection from a peoperties collection. + * Gets a relation collection from a properties collection. * * @param $filename * @@ -655,7 +655,7 @@ protected static function getRelations(array $properties) } /** - * Gets a relation collection from a peoperties collection. + * Gets a relation collection from a properties collection. * * @param $filename * @@ -673,7 +673,7 @@ protected static function getIndexes(array $properties) } /** - * Gets the content of the resource json file. + * Gets the content of the resource JSON file. * * @param $filename * diff --git a/src/Models/ViewInput.php b/src/Models/ViewInput.php index ef4bac8..bf02a31 100644 --- a/src/Models/ViewInput.php +++ b/src/Models/ViewInput.php @@ -31,7 +31,7 @@ class ViewInput public $viewsDirectory; /** - * The provided route's pre-fix + * The provided route's prefix * * @var string */ @@ -77,7 +77,7 @@ public function __construct(array $arguments, array $options = []) } /** - * Gets array of the paramets + * Gets array of the parameters * * @return array */ diff --git a/src/Support/Arr.php b/src/Support/Arr.php index 2e8f8d2..fbc5a63 100644 --- a/src/Support/Arr.php +++ b/src/Support/Arr.php @@ -20,7 +20,7 @@ public static function isAssociative(array $items) } /** - * Wrapps each item in an array with a given string + * Wraps each item in an array with a given string * * @param array $items * @param string $wrapper @@ -37,8 +37,8 @@ public static function wrapItems(array $items, $wrapper = "'") } /** - * It splits a given string by a given seperator after trimming each part - * from whitespaces and single/double quotes. Any empty string is eliminated. + * It splits a given string by a given separator after trimming each part + * from white spaces and single/double quotes. Any empty string is eliminated. * * @param string $str * @param string $seperator @@ -92,8 +92,8 @@ public static function isMatch(array $subjects, $search) } /** - * It trims each element in a givin array and removes the empty elements. - * If a callback is passed as a second parameter, the callbacl is applied on each item. + * It trims each element in a given array and removes the empty elements. + * If a callback is passed as a second parameter, the callback is applied on each item. * * @param array $items * @param function $callback diff --git a/src/Support/Config.php b/src/Support/Config.php index acd2508..1f49901 100644 --- a/src/Support/Config.php +++ b/src/Support/Config.php @@ -157,16 +157,6 @@ public static function getKeyPatterns() return self::getArrayBaseValue('common_key_patterns'); } - /** - * Gets the template names that uses Laravel-Collective - * - * @return array - */ - public static function getCollectiveTemplates() - { - return self::getArrayBaseValue('laravel_collective_templates'); - } - /** * Gets the default template name. * @@ -198,7 +188,7 @@ public static function getCustomModelTemplates() } /** - * Gets the eloquent's method to html + * Gets the Eloquent's method to HTML * * @return array */ diff --git a/src/Support/FieldOptimizer.php b/src/Support/FieldOptimizer.php index 756c4c9..497c671 100644 --- a/src/Support/FieldOptimizer.php +++ b/src/Support/FieldOptimizer.php @@ -33,7 +33,7 @@ class FieldOptimizer protected $meta; /** - * Create a new optemizer instance. + * Create a new optimizer instance. * * @param CrestApps\CodeGenerator\Models\Field $field * @param array $meta @@ -176,7 +176,7 @@ protected function optimizeHtmlType() if ($this->field->hasForeignRelation()) { // At this point we know the field has a foreign relation // set the htmlType to select since the user will have to select an item(s) - // from a colelction + // from a collection $this->field->htmlType = 'select'; } @@ -198,7 +198,7 @@ protected function optimizeBoolean() } /** - * If the property name is "id" or if the field is primary or autoincrement. + * If the property name is "id" or if the field is primary or auto increment. * Ensure, the datatype is set to be valid otherwise make it "int". * It also make sure the primary column does not appears on the views unless it specified * diff --git a/src/Support/FieldTransformer.php b/src/Support/FieldTransformer.php index 15c6e31..1e8c9e1 100644 --- a/src/Support/FieldTransformer.php +++ b/src/Support/FieldTransformer.php @@ -52,7 +52,7 @@ class FieldTransformer protected $languages = []; /** - * It transfres a gining array to a collection of field + * It transfers a given array to a collection of field * * @param array $collection * @param string $localeGroup @@ -69,7 +69,7 @@ public static function fromArray(array $collection, $localeGroup, array $languag } /** - * It transfres a gining array to a collection of field + * It transfers a given array to a collection of field * * @param string $str * @param string $localeGroup @@ -135,7 +135,7 @@ public static function fromString($str, $localeGroup = 'generic', array $languag } /** - * It transfres a gining string to a collection of field + * It transfers a given string to a collection of field * * @param string|json $json * @param string $localeGroup @@ -184,7 +184,7 @@ protected function getFields() } /** - * It transfres the raw fields into Fields by setting the $this->fields array + * It transfers the raw fields into Fields by setting the $this->fields array * * @return $this */ @@ -192,7 +192,7 @@ protected function transfer() { $names = array_column($this->rawFields, 'name'); if (array_unique($names) !== $names) { - throw new Exception('Each field name must be unique. Please check the profided field names'); + throw new Exception('Each field name must be unique. Please check the predefined field names'); } $mappers = []; diff --git a/src/Support/FieldsOptimizer.php b/src/Support/FieldsOptimizer.php index 2048123..b8ca04a 100644 --- a/src/Support/FieldsOptimizer.php +++ b/src/Support/FieldsOptimizer.php @@ -23,7 +23,7 @@ class FieldsOptimizer protected $fields = []; /** - * Create a new optemizer instance. + * Create a new optimizer instance. * * @param array $mappers * @@ -45,7 +45,7 @@ public function getFields() } /** - * Optemizes the fields. + * Optimizes the fields. * * @return void */ diff --git a/src/Support/Helpers.php b/src/Support/Helpers.php index 8e4d954..f86c402 100644 --- a/src/Support/Helpers.php +++ b/src/Support/Helpers.php @@ -29,6 +29,31 @@ public static function makeControllerName($modelName) return $case; } + /** + * Makes a api-docs controller name from a given model name + * + * @param string $modelName + * + * @return string + */ + public static function makeApiDocsControllerName($modelName) + { + return self::makeControllerName($modelName . 'ApiDocs'); + } + + /** + * Makes a api controller name from a given model name + * + * @param string $modelName + * + * @return string + */ + public static function makeApiControllerName($modelName) + { + return self::makeControllerName($modelName . 'Api'); + } + + /** * Makes an api-resource name from a given model name * @@ -104,7 +129,7 @@ public static function fixNamespace($path) } /** - * Gets the app namespace afer concatenating any given paths to it + * Gets the app namespace after concatenating any given paths to it * * @param mix $paths * @@ -192,7 +217,7 @@ public static function makeRouteGroup($modelName) } /** - * Makes the json file name + * Makes the JSON file name * * @param string $modelName * @@ -206,7 +231,7 @@ public static function makeJsonFileName($modelName) } /** - * Check if the current laravel version has api-support + * Check if the current Laravel version has api-support * * @return bool */ diff --git a/src/Support/MigrationHistoryTracker.php b/src/Support/MigrationHistoryTracker.php index 3101c1c..4c6e5d2 100644 --- a/src/Support/MigrationHistoryTracker.php +++ b/src/Support/MigrationHistoryTracker.php @@ -101,7 +101,7 @@ public function update($tableName, array $properties) } /** - * Checks if a migration tracker exists for a given datatable + * Checks if a migration tracker exists for a given data table * * @param string $tableName * @@ -170,7 +170,7 @@ protected function read() } /** - * Removeds a migration entry from the file given the table name. + * Removes a migration entry from the file given the table name. * * @param string $tableName * diff --git a/src/Support/Str.php b/src/Support/Str.php index c341d6f..85d45fd 100644 --- a/src/Support/Str.php +++ b/src/Support/Str.php @@ -193,7 +193,7 @@ public static function trimQuots($subject) } /** - * Makes the proper english case given name and a file type + * Makes the proper English case given name and a file type * * @param string $name * @param string $key @@ -212,7 +212,7 @@ public static function properSnake($name, $key) } /** - * Adds a preFix string at the begining of another given string if it does not already ends with it. + * Adds a preFix string at the beginning of another given string if it does not already ends with it. * * @param string $name * @param string $fix @@ -246,7 +246,7 @@ public static function postfix($subject, $fix) } /** - * Replaces any non-english letters with an empty string + * Replaces any non-English letters with an empty string * * @param string $str * @param bool $keep diff --git a/src/Support/ValidationParser.php b/src/Support/ValidationParser.php index b02d8c4..277758c 100644 --- a/src/Support/ValidationParser.php +++ b/src/Support/ValidationParser.php @@ -76,7 +76,7 @@ class ValidationParser protected $numeric; /** - * Conditional requied rule + * Conditional required rule * * @var mix */ @@ -174,7 +174,7 @@ public function getSizeValue() } /** - * Checks if the rules conatins a required rule + * Checks if the rules contains a required rule * * @return bool */ @@ -242,7 +242,7 @@ public function isString() } /** - * Checks if the rules is valid numer + * Checks if the rules is valid number. * * @return bool */ @@ -266,7 +266,7 @@ public function isConditionalRequired() } /** - * Checks if the rules is nullable + * Checks if the rules is nullable. * * @return bool */ @@ -280,7 +280,7 @@ public function isNullable() } /** - * Checks if the rules is interger. + * Checks if the rules is integer. * * @return bool */ diff --git a/src/Support/ViewLabelsGenerator.php b/src/Support/ViewLabelsGenerator.php index 80cc141..0935142 100644 --- a/src/Support/ViewLabelsGenerator.php +++ b/src/Support/ViewLabelsGenerator.php @@ -42,19 +42,12 @@ class ViewLabelsGenerator */ protected $defaultLang; - /** - * Generate labels for collective template? - * - * @var bool - */ - protected $isCollectiveTemplate; - /** * Create a new transformer instance. * * @return void */ - public function __construct($modelName, array $fields, $isCollectiveTemplate) + public function __construct($modelName, array $fields) { if (empty($modelName)) { throw new Exception("$modelName must have a valid value"); @@ -64,7 +57,6 @@ public function __construct($modelName, array $fields, $isCollectiveTemplate) $this->fields = $fields; $this->localeGroup = self::makeLocaleGroup($modelName); $this->defaultLang = App::getLocale(); - $this->isCollectiveTemplate = $isCollectiveTemplate; } /** @@ -142,21 +134,7 @@ protected function makeModelLabel($key, array $properties, $isPlain, $lang) $label = new Label($text, $this->localeGroup, $isPlain, $lang, $key); $label->template = $properties['template']; - $label->isInFunction = $this->isInFunction($properties); return $label; } - - /** - * Checks if the given properties request to put the label in a function. - * - * @param array $properties - * - * @return bool - */ - protected function isInFunction(array $properties) - { - return $this->isCollectiveTemplate - && (isset($properties['in-function-with-collective']) && $properties['in-function-with-collective']); - } } diff --git a/src/Traits/ApiDocViewsTrait.php b/src/Traits/ApiDocViewsTrait.php index bdfa0d7..aa300d6 100644 --- a/src/Traits/ApiDocViewsTrait.php +++ b/src/Traits/ApiDocViewsTrait.php @@ -42,7 +42,7 @@ protected function getPathToViews($viewsDirectory) } /** - * Gets destenation view path + * Gets destination view path * * @param string $viewsDirectory * @param string $routesPrefix diff --git a/src/Traits/ApiResourceTrait.php b/src/Traits/ApiResourceTrait.php index 286af78..46c2237 100644 --- a/src/Traits/ApiResourceTrait.php +++ b/src/Traits/ApiResourceTrait.php @@ -122,7 +122,7 @@ protected function getApiResourceCollectionNamespace($className = '') } /** - * Gets the api-resource's destenation path + * Gets the api-resource's destination path * * @return string */ @@ -140,7 +140,7 @@ protected function getApiResourcePath() } /** - * Gets the api-resource-collection's destenation path + * Gets the api-resource-collection's destination path * * @return string */ @@ -179,7 +179,7 @@ protected function getTransformMethod($input, array $fields, $useDefaultAccessor } /** - * Replaces the model fullname for the given stub, + * Replaces the model full name for the given stub. * * @param string $stub * @param string $name @@ -255,5 +255,4 @@ protected function replaceTransformMethodName(&$stub, $name) { return $this->replaceTemplate('transform_method_name', $name, $stub); } - } diff --git a/src/Traits/CommonCommand.php b/src/Traits/CommonCommand.php index 92c1f86..8d47825 100644 --- a/src/Traits/CommonCommand.php +++ b/src/Traits/CommonCommand.php @@ -90,7 +90,7 @@ protected function getTemplateVariable($key) } /** - * Gets the relation accessor for the given foreign renationship. + * Gets the relation accessor for the given foreign relationship. * * @param string $name * @@ -295,7 +295,7 @@ protected function getStubByName($name, $template = null) protected function replaceRouteNames(&$stub, $modelName, $routesPrefix, array $actions = null) { foreach (($actions ?: $this->actions) as $action) { - $routeName = $this->getDotNotationName($modelName, $routesPrefix, $action); + $routeName = $this->getDotNotationName($this->getModelName($modelName), $routesPrefix, $action); $routeTemplate = $this->getRouteName($action); $stub = $this->strReplace($routeTemplate, $routeName, $stub); } @@ -367,7 +367,7 @@ protected function isFileExists($file) } /** - * Get the givin file content. + * Get the given file content. * * @param string $file * @@ -379,7 +379,7 @@ protected function getFileContent($file) } /** - * Get the givin file content. + * Get the given file content. * * @param string $file * @@ -493,7 +493,7 @@ protected function createFile($file, $stub) } /** - * Checks if the givin field is an instance of a field or not. + * Checks if the given field is an instance of a field or not. * * @return string */ @@ -514,7 +514,7 @@ protected function getPathToTemplates($templateName = null) $templateName = $templateName ?: Config::getDefaultTemplateName(); $path = base_path(Config::getTemplatesPath() . Helpers::getPathWithSlash($templateName)); - if (!File::isDirectory($path) && in_array($templateName, ['default', 'default-collective'])) { + if (!File::isDirectory($path) && in_array($templateName, ['default'])) { // If the default templates are not published, utilize the default package path. $path = __DIR__ . '/../../templates/' . $templateName; @@ -528,19 +528,7 @@ protected function getPathToTemplates($templateName = null) } /** - * Checks the given template if it is a Laravel-Collective template or not. - * - * @param string $template - * - * @return bool - */ - protected function isCollectiveTemplate($template = null) - { - return in_array($template ?: $this->getTemplateName(), Config::getCollectiveTemplates()); - } - - /** - * Checks if a given fields array conatins at least one file field + * Checks if a given fields array contains at least one file field * * @param array * diff --git a/src/Traits/GeneratorReplacers.php b/src/Traits/GeneratorReplacers.php index b88ee58..c909082 100644 --- a/src/Traits/GeneratorReplacers.php +++ b/src/Traits/GeneratorReplacers.php @@ -37,7 +37,7 @@ protected function replaceModelName(&$stub, $modelName, $prefix = 'model_') } /** - * It Replaces the templates of the givin $labels + * It Replaces the templates of the given $labels * * @param string $stub * @param array $items @@ -71,7 +71,7 @@ protected function modelNamePlainEnglish($modelName) } /** - * Replace the controller_name fo the given stub. + * Replace the controller_name for the given stub. * * @param string $stub * @param string $modelName @@ -97,7 +97,7 @@ protected function replacePrimaryKey(&$stub, $primaryKey) } /** - * Replace the app_name fo the given stub. + * Replace the app_name for the given stub. * * @param string $stub * @param string $modelName @@ -110,7 +110,7 @@ protected function replaceAppName(&$stub, $name) } /** - * Replace the namespace fo the given stub. + * Replace the namespace for the given stub. * * @param string $stub * @param string $modelName diff --git a/src/Traits/LanguageTrait.php b/src/Traits/LanguageTrait.php index daff294..e0bc717 100644 --- a/src/Traits/LanguageTrait.php +++ b/src/Traits/LanguageTrait.php @@ -7,7 +7,7 @@ trait LanguageTrait { /** - * Creates a colection of messages out of a given fields collection. + * Creates a collection of messages out of a given fields collection. * * @param array $fields * diff --git a/src/Traits/Migration.php b/src/Traits/Migration.php index 1c3df46..36d57d6 100644 --- a/src/Traits/Migration.php +++ b/src/Traits/Migration.php @@ -77,7 +77,7 @@ protected function setMigrator() /** * Get all the ran migrations is a key value array where the key in the - * migration file name and the value is the fullname of the class. + * migration file name and the value is the full name of the class. * * * @return array diff --git a/src/Traits/ScaffoldTrait.php b/src/Traits/ScaffoldTrait.php index 1c670de..83900f5 100644 --- a/src/Traits/ScaffoldTrait.php +++ b/src/Traits/ScaffoldTrait.php @@ -21,7 +21,7 @@ protected function printInfo($message) } /** - * Gets the model name in plain english from a given model name. + * Gets the model name in plain English from a given model name. * * @param string $modelName * diff --git a/templates/default-collective/api-controller-base-class.stub b/templates/default-collective/api-controller-base-class.stub deleted file mode 100644 index 5cdad7a..0000000 --- a/templates/default-collective/api-controller-base-class.stub +++ /dev/null @@ -1,15 +0,0 @@ -successResponse( - [% model_was_deleted %], - $this->transform($[% model_name_singular_variable %]) - ); \ No newline at end of file diff --git a/templates/default-collective/api-controller-call-index-api-resource.stub b/templates/default-collective/api-controller-call-index-api-resource.stub deleted file mode 100644 index 9d01d03..0000000 --- a/templates/default-collective/api-controller-call-index-api-resource.stub +++ /dev/null @@ -1 +0,0 @@ -return new [% api_resource_collection_class %]($[% model_name_plural_variable %], [% models_were_retrieved %]); \ No newline at end of file diff --git a/templates/default-collective/api-controller-call-index-success-method.stub b/templates/default-collective/api-controller-call-index-success-method.stub deleted file mode 100644 index 1ac32cd..0000000 --- a/templates/default-collective/api-controller-call-index-success-method.stub +++ /dev/null @@ -1,26 +0,0 @@ -$[% data_variable %] = $[% model_name_plural_variable %]->transform(function ($[% model_name_singular_variable %]) { - return $this->transform($[% model_name_singular_variable %]); - }); - - return $this->successResponse( - [% models_were_retrieved %], - $[% data_variable %], - [ - 'links' => [ - 'first' => $[% model_name_plural_variable %]->url(1), - 'last' => $[% model_name_plural_variable %]->url($[% model_name_plural_variable %]->lastPage()), - 'prev' => $[% model_name_plural_variable %]->previousPageUrl(), - 'next' => $[% model_name_plural_variable %]->nextPageUrl(), - ], - 'meta' => - [ - 'current_page' => $[% model_name_plural_variable %]->currentPage(), - 'from' => $[% model_name_plural_variable %]->firstItem(), - 'last_page' => $[% model_name_plural_variable %]->lastPage(), - 'path' => $[% model_name_plural_variable %]->resolveCurrentPath(), - 'per_page' => $[% model_name_plural_variable %]->perPage(), - 'to' => $[% model_name_plural_variable %]->lastItem(), - 'total' => $[% model_name_plural_variable %]->total(), - ], - ] - ); \ No newline at end of file diff --git a/templates/default-collective/api-controller-call-show-api-resource.stub b/templates/default-collective/api-controller-call-show-api-resource.stub deleted file mode 100644 index c9c453d..0000000 --- a/templates/default-collective/api-controller-call-show-api-resource.stub +++ /dev/null @@ -1 +0,0 @@ -return new [% api_resource_class %]($[% model_name_singular_variable %], [% model_was_retrieved %]); \ No newline at end of file diff --git a/templates/default-collective/api-controller-call-show-success-method.stub b/templates/default-collective/api-controller-call-show-success-method.stub deleted file mode 100644 index c35ff81..0000000 --- a/templates/default-collective/api-controller-call-show-success-method.stub +++ /dev/null @@ -1,4 +0,0 @@ -return $this->successResponse( - [% model_was_retrieved %], - $this->transform($[% model_name_singular_variable %]) - ); \ No newline at end of file diff --git a/templates/default-collective/api-controller-call-store-api-resource.stub b/templates/default-collective/api-controller-call-store-api-resource.stub deleted file mode 100644 index 48c1110..0000000 --- a/templates/default-collective/api-controller-call-store-api-resource.stub +++ /dev/null @@ -1 +0,0 @@ -return new [% api_resource_class %]($[% model_name_singular_variable %], [% model_was_added %]); \ No newline at end of file diff --git a/templates/default-collective/api-controller-call-store-success-method.stub b/templates/default-collective/api-controller-call-store-success-method.stub deleted file mode 100644 index e03ecd1..0000000 --- a/templates/default-collective/api-controller-call-store-success-method.stub +++ /dev/null @@ -1,4 +0,0 @@ -return $this->successResponse( - [% model_was_added %], - $this->transform($[% model_name_singular_variable %]) - ); \ No newline at end of file diff --git a/templates/default-collective/api-controller-call-update-api-resource.stub b/templates/default-collective/api-controller-call-update-api-resource.stub deleted file mode 100644 index ba91ac7..0000000 --- a/templates/default-collective/api-controller-call-update-api-resource.stub +++ /dev/null @@ -1 +0,0 @@ -return new [% api_resource_class %]($[% model_name_singular_variable %], [% model_was_updated %]); \ No newline at end of file diff --git a/templates/default-collective/api-controller-call-update-success-method.stub b/templates/default-collective/api-controller-call-update-success-method.stub deleted file mode 100644 index 5ea663a..0000000 --- a/templates/default-collective/api-controller-call-update-success-method.stub +++ /dev/null @@ -1,4 +0,0 @@ -return $this->successResponse( - [% model_was_updated %], - $this->transform($[% model_name_singular_variable %]) - ); \ No newline at end of file diff --git a/templates/default-collective/api-controller-error-response-method.stub b/templates/default-collective/api-controller-error-response-method.stub deleted file mode 100644 index 8b8879e..0000000 --- a/templates/default-collective/api-controller-error-response-method.stub +++ /dev/null @@ -1,14 +0,0 @@ - /** - * Get an error response - * - * @param mix $message - * - * @return Illuminate\Http\Response - */ - protected function errorResponse($message) - { - return response()->json([ - 'errors' => (array) $message, - 'success' => false, - ], 422); - } diff --git a/templates/default-collective/api-controller-get-validator.stub b/templates/default-collective/api-controller-get-validator.stub deleted file mode 100644 index 4414601..0000000 --- a/templates/default-collective/api-controller-get-validator.stub +++ /dev/null @@ -1,16 +0,0 @@ - - /** - * Gets a new validator instance with the defined rules. - * - * @param [% request_fullname %] $request - * - * @return Illuminate\Support\Facades\Validator - */ - protected function getValidator(Request $request) - { - $rules = [ -[% validation_rules %] - ]; -[% file_validation_snippet %] - return Validator::make($request->all(), $rules); - } diff --git a/templates/default-collective/api-controller-success-response-method.stub b/templates/default-collective/api-controller-success-response-method.stub deleted file mode 100644 index d8609e4..0000000 --- a/templates/default-collective/api-controller-success-response-method.stub +++ /dev/null @@ -1,18 +0,0 @@ - /** - * Get a success response - * - * @param mix $message - * @param mix $data - * @param array $meta - * - * @return Illuminate\Http\Response - */ - protected function successResponse($message, $data, array $meta = []) - { - return response()->json( - array_merge([ - 'data' => $data, - 'message' => $message, - 'success' => true, - ], $meta), 200); - } \ No newline at end of file diff --git a/templates/default-collective/api-controller-transform-method.stub b/templates/default-collective/api-controller-transform-method.stub deleted file mode 100644 index 950f975..0000000 --- a/templates/default-collective/api-controller-transform-method.stub +++ /dev/null @@ -1,13 +0,0 @@ - /** - * Transform the giving [% model_name %] to public friendly array - * - * @param [% use_full_model_name %] $[% model_name_singular_variable %] - * - * @return array - */ - protected function [% transform_method_name %]([% model_name_class %] $[% model_name_singular_variable %]) - { - return [ -[% model_api_array %] - ]; - } diff --git a/templates/default-collective/api-controller-validate.stub b/templates/default-collective/api-controller-validate.stub deleted file mode 100644 index c582ea6..0000000 --- a/templates/default-collective/api-controller-validate.stub +++ /dev/null @@ -1,5 +0,0 @@ -$validator = $this->getValidator($request); - - if ($validator->fails()) { - return $this->errorResponse($validator->errors()->all()); - } diff --git a/templates/default-collective/api-controller.stub b/templates/default-collective/api-controller.stub deleted file mode 100644 index ad86836..0000000 --- a/templates/default-collective/api-controller.stub +++ /dev/null @@ -1,104 +0,0 @@ -errorResponse([% unexpected_error %]); - } - } - - /** - * Display the specified [% model_name %]. - * - * @param int $id - * - * @return Illuminate\Http\Response - */ - public function show($id) - { - $[% model_name_singular_variable %] = [% model_name_class %]::[% with_relations_for_show %]findOrFail($id); - - [% show_return_success %] - } - - /** - * Update the specified [% model_name %] in the storage. - * - * @param int $id - * @param [% request_fullname %] [% request_variable %] - * - * @return Illuminate\Http\Response - */ - public function update($id, [% type_hinted_request_name %]) - { - try { - [% validator_request %] - $[% data_variable %] = [% call_get_data %]; - [% on_update_setter %] - $[% model_name_singular_variable %] = [% model_name_class %]::findOrFail($id); - $[% model_name_singular_variable %]->update($[% data_variable %]); - - [% update_return_success %] - } catch (Exception $exception) { - return $this->errorResponse([% unexpected_error %]); - } - } - - /** - * Remove the specified [% model_name %] from the storage. - * - * @param int $id - * - * @return Illuminate\Http\Response - */ - public function destroy($id) - { - try { - $[% model_name_singular_variable %] = [% model_name_class %]::findOrFail($id); - $[% model_name_singular_variable %]->delete(); - - [% destroy_return_success %] - } catch (Exception $exception) { - return $this->errorResponse([% unexpected_error %]); - } - } -[% get_validator_method %] -[% get_data_method %] -[% upload_method %] -[% transform_method %] -[% response_methods %] -} diff --git a/templates/default-collective/api-documentation-controller-version-based.stub b/templates/default-collective/api-documentation-controller-version-based.stub deleted file mode 100644 index d7c8117..0000000 --- a/templates/default-collective/api-documentation-controller-version-based.stub +++ /dev/null @@ -1,21 +0,0 @@ -getVersion($version)); - - return view($viewName); - } -} diff --git a/templates/default-collective/api-documentation-controller.stub b/templates/default-collective/api-documentation-controller.stub deleted file mode 100644 index 1b27cfe..0000000 --- a/templates/default-collective/api-documentation-controller.stub +++ /dev/null @@ -1,20 +0,0 @@ -[% required_title %] \ No newline at end of file diff --git a/templates/default-collective/api-documentation-index-authentication.stub b/templates/default-collective/api-documentation-index-authentication.stub deleted file mode 100644 index eb6a978..0000000 --- a/templates/default-collective/api-documentation-index-authentication.stub +++ /dev/null @@ -1,11 +0,0 @@ - - Authorization - [% string_title %] - - [% header_title %] - - [% access_token_with_bearer %] - @if(isset($showValidation) && $showValidation) - - @endif - diff --git a/templates/default-collective/api-documentation-index-failed-authentication.stub b/templates/default-collective/api-documentation-index-failed-authentication.stub deleted file mode 100644 index e412621..0000000 --- a/templates/default-collective/api-documentation-index-failed-authentication.stub +++ /dev/null @@ -1,16 +0,0 @@ -

    401 - Unauthorized

    -

    [% the_user_does_not_have_permission_to_access_the_requested_resource %]

    - - - - - - - - - - - - - -
    success[% boolean_title %][% indicate_whether_the_request_was_successful_or_not %]
    error[% array_of_strings %][% the_error_message %]
    diff --git a/templates/default-collective/api-documentation-index-failed-to-retrieve.stub b/templates/default-collective/api-documentation-index-failed-to-retrieve.stub deleted file mode 100644 index d94ce7a..0000000 --- a/templates/default-collective/api-documentation-index-failed-to-retrieve.stub +++ /dev/null @@ -1,16 +0,0 @@ -

    202 - Accepted

    -

    [% the_requested_model_does_not_exists %]

    - - - - - - - - - - - - - -
    success[% boolean_title %][% indicate_whether_the_request_was_successful_or_not %]
    error[% array_of_strings %][% the_error_message %]
    diff --git a/templates/default-collective/api-documentation-index-failed-validation.stub b/templates/default-collective/api-documentation-index-failed-validation.stub deleted file mode 100644 index 06c98b6..0000000 --- a/templates/default-collective/api-documentation-index-failed-validation.stub +++ /dev/null @@ -1,16 +0,0 @@ -

    422 - Unprocessable Entity

    -

    [% the_request_failed_validation %]

    - - - - - - - - - - - - - -
    success[% boolean_title %][% indicate_whether_the_request_was_successful_or_not %]
    errors[% array_of_strings %][% list_of_the_invalid_errors %]
    diff --git a/templates/default-collective/api-documentation-index-fields-list-body-row-for-model.stub b/templates/default-collective/api-documentation-index-fields-list-body-row-for-model.stub deleted file mode 100644 index 125a36d..0000000 --- a/templates/default-collective/api-documentation-index-fields-list-body-row-for-model.stub +++ /dev/null @@ -1,5 +0,0 @@ - - [% field_name %] - [% field_type_title %] - [% api_field_description %] - diff --git a/templates/default-collective/api-documentation-index-fields-list-body-row.stub b/templates/default-collective/api-documentation-index-fields-list-body-row.stub deleted file mode 100644 index 21c2c77..0000000 --- a/templates/default-collective/api-documentation-index-fields-list-body-row.stub +++ /dev/null @@ -1,12 +0,0 @@ - - [% field_name %] - [% field_type_title %] - [% body_title %] - [% api_field_description %] - @if($showValidation) - - [% validation_rule_required %] - [% validation_rules %] - - @endif - diff --git a/templates/default-collective/api-documentation-index-fields-list.stub b/templates/default-collective/api-documentation-index-fields-list.stub deleted file mode 100644 index c7c5429..0000000 --- a/templates/default-collective/api-documentation-index-fields-list.stub +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - - - - @if($showValidation) - - @endif - - - - [% include_parameter_for_authorized_request %] - @if(isset($withPathId) && $withPathId) - - - - - - @if($showValidation) - - @endif - - - @endif - - [% fields_list_for_body %] - - - -
    [% parameter_name_title %][% data_type_title %][% parameter_type_title %][% description_title %][% validation_title %]
    [% model_name %][% primary_key_type_title %][% path_title %][% the_id_of_the_model %] - [% validation_rule_required %] -
    diff --git a/templates/default-collective/api-documentation-index-request.stub b/templates/default-collective/api-documentation-index-request.stub deleted file mode 100644 index bd1278a..0000000 --- a/templates/default-collective/api-documentation-index-request.stub +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - [% include_parameter_for_authorized_request %] - - -
    [% parameter_name_title %][% data_type_title %][% parameter_type_title %][% description_title %]
    diff --git a/templates/default-collective/api-documentation-index-retrieved-fields-body-row.stub b/templates/default-collective/api-documentation-index-retrieved-fields-body-row.stub deleted file mode 100644 index 125a36d..0000000 --- a/templates/default-collective/api-documentation-index-retrieved-fields-body-row.stub +++ /dev/null @@ -1,5 +0,0 @@ - - [% field_name %] - [% field_type_title %] - [% api_field_description %] - diff --git a/templates/default-collective/api-documentation-index-retrieved-fields.stub b/templates/default-collective/api-documentation-index-retrieved-fields.stub deleted file mode 100644 index 0c93577..0000000 --- a/templates/default-collective/api-documentation-index-retrieved-fields.stub +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - -[% fields_list_for_body %] - -
    [% name_title %][% type_title %][% description_title %]
    diff --git a/templates/default-collective/api-documentation-index-retrieved.stub b/templates/default-collective/api-documentation-index-retrieved.stub deleted file mode 100644 index 2c8cd87..0000000 --- a/templates/default-collective/api-documentation-index-retrieved.stub +++ /dev/null @@ -1,21 +0,0 @@ -

    200 - Ok

    -

    [% request_was_successful %]

    - - - - - - - - - - - - - - - - - - -
    success[% boolean_title %][% indicate_whether_the_request_was_successful_or_not %]
    message[% string_title %][% the_success_message %]
    data[% array_title %][% the_key_is_the_model_property_and_the_value_is_the_model_value %]
    diff --git a/templates/default-collective/api-documentation-index.stub b/templates/default-collective/api-documentation-index.stub deleted file mode 100644 index 00d7519..0000000 --- a/templates/default-collective/api-documentation-index.stub +++ /dev/null @@ -1,417 +0,0 @@ -@extends('[% layout_name %]') - -@section('content') - -

    [% model_plural %]

    -[% general_description %] -
    - -

    [% available_resources %]

    -
    -
    - -
    -
    GET
    - /{{ Route::getRoutes()->getByName('[% index_route_name %]')->uri() }} - [% index_route_description %] -
    -
    - - - -
    - -
    - -
    -
    -

    [% request_title %]

    - [% authorized_request_for_index %] - -
    -

    [% response_title %]

    - -

    [% index_route_response_description %]

    -

    - -

    200 - Ok

    -

    [% request_was_successful %]

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    success[% boolean_title %]Was the request successful or not.
    message[% string_title %][% the_success_message %]
    data[% array_title %] - [% the_key_is_the_model_property_and_the_value_is_the_model_value %] -
    links[% array_title %] - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    [% key_title %][% data_type_title %][% description_title %]
    first[% string_title %][% link_to_retrieve_first_page %]
    last[% string_title %][% link_to_retrieve_last_page %]
    prev[% string_title %][% link_to_retrieve_previous_page %]
    next[% string_title %][% link_to_retrieve_next_page %]
    - -
    meta[% array_title %] - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    [% key_title %][% data_type_title %][% description_title %]
    current_page[% integer_title %][% the_number_of_current_page %]
    from[% integer_title %][% the_index_of_the_first_retrieved_item %]
    last_page[% integer_title %][% the_number_of_the_last_page %]
    Path[% string_title %][% the_base_link_to_the_resource %]
    per_page[% integer_title %][% the_number_of_models_per_page %]
    to[% integer_title %][% the_index_of_the_last_retrieved_item %]
    total[% integer_title %][% the_total_of_available_pages %]
    - -
    - - [% include_failed_authentication_for_authorized_request %] - -
    -
    -
    - - -
    -
    - -
    -
    POST
    - /{{ Route::getRoutes()->getByName('[% store_route_name %]')->uri() }} - [% store_route_description %] -
    -
    - - - -
    - -
    - -
    -
    -

    [% request_title %]

    - - @include('[% path_to_view_home %]fields-list', [ - 'withValidation' => true - ]) - -
    -

    [% response_title %]

    -

    [% store_route_response_description %]

    -

    - - @include('[% path_to_view_home %]retrieved') - @include('[% path_to_view_home %]failed-to-retrieve') - @include('[% path_to_view_home %]failed-validation') - [% include_failed_authentication_for_authorized_request %] - -
    -
    -
    - - - -
    -
    - -
    -
    POST
    - /{{ Route::getRoutes()->getByName('[% update_route_name %]')->uri() }} - [% update_route_description %] -
    -
    - - - -
    - -
    - -
    -
    - -

    [% request_title %]

    - - @include('[% path_to_view_home %]fields-list', [ - 'withValidation' => true, - 'withPathId' => true, - ]) - -
    -

    [% response_title %]

    -

    [% update_route_response_description %]

    -

    - - @include('[% path_to_view_home %]retrieved') - @include('[% path_to_view_home %]failed-to-retrieve') - @include('[% path_to_view_home %]failed-validation') - [% include_failed_authentication_for_authorized_request %] - -
    -
    -
    - - - -
    -
    - -
    -
    GET
    - /{{ Route::getRoutes()->getByName('[% show_route_name %]')->uri() }} - [% show_route_description %] -
    -
    - - - - -
    - -
    - -
    -
    - -

    [% request_title %]

    - - - - - - - - - - - - [% include_parameter_for_authorized_request %] - - - - - - - -
    [% parameter_name_title %][% data_type_title %][% parameter_type_title %][% description_title %]
    [% model_name %][% integer_title %][% path_title %][% the_id_of_model_to_retrieve %]
    - - -
    -

    [% response_title %]

    -

    [% show_route_response_description %]

    -

    - - @include('[% path_to_view_home %]retrieved') - @include('[% path_to_view_home %]failed-to-retrieve') - [% include_failed_authentication_for_authorized_request %] - -
    -
    -
    - - - -
    -
    - -
    -
    DELETE
    - /{{ Route::getRoutes()->getByName('[% destroy_route_name %]')->uri() }} - [% destroy_route_description %] -
    -
    - - - -
    - -
    - -
    -
    - -

    [% request_title %]

    - - - - - - - - - - - - [% include_parameter_for_authorized_request %] - - - - - - - -
    [% parameter_name_title %][% data_type_title %][% parameter_type_title %][% description_title %]
    [% model_name %][% integer_title %][% path_title %][% the_id_of_model_to_delete %]
    - - -
    -

    [% response_title %]

    -

    [% destroy_route_response_description %]

    -

    - - @include('[% path_to_view_home %]retrieved') - @include('[% path_to_view_home %]failed-to-retrieve') - [% include_failed_authentication_for_authorized_request %] - -
    -
    -
    - -
    - -

    [% model_definition_title %]

    -
    -
    - -
    - [% model_name_title %] -
    -
    - - - -
    - -
    - -
    -
    - - - - - - - - - - [% fields_list_for_body %] - -
    [% field_name_title %][% field_type_title %][% description_title %]
    -
    -
    -
    - -
    - -@endsection diff --git a/templates/default-collective/api-documentation-routes-8.stub b/templates/default-collective/api-documentation-routes-8.stub deleted file mode 100644 index 1e3291f..0000000 --- a/templates/default-collective/api-documentation-routes-8.stub +++ /dev/null @@ -1,2 +0,0 @@ -Route::get('[% prefix %][% version %]', [[% controller_name %]::class, 'index']) - ->name('[% index_route_name %]'); diff --git a/templates/default-collective/api-documentation-routes.stub b/templates/default-collective/api-documentation-routes.stub deleted file mode 100644 index d74d23f..0000000 --- a/templates/default-collective/api-documentation-routes.stub +++ /dev/null @@ -1,2 +0,0 @@ -Route::get('[% prefix %][% version %]', '[% controller_name %]@index') - ->name('[% index_route_name %]'); diff --git a/templates/default-collective/api-documentation-version-based-base-controller.stub b/templates/default-collective/api-documentation-version-based-base-controller.stub deleted file mode 100644 index 9f4201d..0000000 --- a/templates/default-collective/api-documentation-version-based-base-controller.stub +++ /dev/null @@ -1,38 +0,0 @@ -versions)) { - return $version; - } - - return end($this->versions); - } -} \ No newline at end of file diff --git a/templates/default-collective/api-resource-collection.stub b/templates/default-collective/api-resource-collection.stub deleted file mode 100644 index f6f8578..0000000 --- a/templates/default-collective/api-resource-collection.stub +++ /dev/null @@ -1,50 +0,0 @@ -message = $message; - } - - /** - * Transform the resource collection into an array. - * - * @param \Illuminate\Http\Request - * @return array - */ - public function toArray($request) - { - return [ - 'data' => $this->collection->transform(function ($[% model_name_singular_variable %]) { - return $this->transformModel($[% model_name_singular_variable %]); - }), - 'message' => $this->message, - 'success' => true, - ]; - } - -[% transform_method %] -} diff --git a/templates/default-collective/api-resource.stub b/templates/default-collective/api-resource.stub deleted file mode 100644 index addba74..0000000 --- a/templates/default-collective/api-resource.stub +++ /dev/null @@ -1,59 +0,0 @@ -message = $message; - } - - /** - * Transform the resource into an array. - * - * @param \Illuminate\Http\Request $request - * - * @return array - */ - public function toArray($request) - { - return [ -[% model_api_array %] - ]; - } - - /** - * Get any additional data that should be returned with the resource array. - * - * @param \Illuminate\Http\Request $request - * - * @return array - */ - public function with($request) - { - return [ - 'success' => true, - 'message' => $this->message, - ]; - } -} diff --git a/templates/default-collective/api-routes-8.stub b/templates/default-collective/api-routes-8.stub deleted file mode 100644 index 28e3886..0000000 --- a/templates/default-collective/api-routes-8.stub +++ /dev/null @@ -1,10 +0,0 @@ - Route::get('/', [[% controller_name %]::class, 'index']) - ->name('[% index_route_name %]'); - Route::get('/show/{[% model_name_singular_variable %]}',[[% controller_name %]::class, 'show']) - ->name('[% show_route_name %]')[% route_id_clause %]; - Route::post('/', [[% controller_name %]::class, 'store']) - ->name('[% store_route_name %]'); - Route::put('[% model_name_snake %]/{[% model_name_singular_variable %]}', [[% controller_name %]::class, 'update']) - ->name('[% update_route_name %]')[% route_id_clause %]; - Route::delete('/[% model_name_snake %]/{[% model_name_singular_variable %]}',[[% controller_name %]::class, 'destroy']) - ->name('[% destroy_route_name %]')[% route_id_clause %]; \ No newline at end of file diff --git a/templates/default-collective/api-routes.stub b/templates/default-collective/api-routes.stub deleted file mode 100644 index bd4043d..0000000 --- a/templates/default-collective/api-routes.stub +++ /dev/null @@ -1,10 +0,0 @@ - Route::get('/', '[% controller_name %]@index') - ->name('[% index_route_name %]'); - Route::get('/show/{[% model_name_singular_variable %]}','[% controller_name %]@show') - ->name('[% show_route_name %]')[% route_id_clause %]; - Route::post('/', '[% controller_name %]@store') - ->name('[% store_route_name %]'); - Route::put('[% model_name_snake %]/{[% model_name_singular_variable %]}', '[% controller_name %]@update') - ->name('[% update_route_name %]')[% route_id_clause %]; - Route::delete('/[% model_name_snake %]/{[% model_name_singular_variable %]}','[% controller_name %]@destroy') - ->name('[% destroy_route_name %]')[% route_id_clause %]; \ No newline at end of file diff --git a/templates/default-collective/controller-affirm-method.stub b/templates/default-collective/controller-affirm-method.stub deleted file mode 100644 index 7e76d9d..0000000 --- a/templates/default-collective/controller-affirm-method.stub +++ /dev/null @@ -1,17 +0,0 @@ - - /** - * Validate the given request with the defined rules. - * - * @param [% request_fullname %] $request - * - * @return boolean - */ - protected function affirm(Request $request) - { - $rules = [ -[% validation_rules %] - ]; -[% file_validation_snippet %] - - return $this->validate($request, $rules); - } diff --git a/templates/default-collective/controller-constructor.stub b/templates/default-collective/controller-constructor.stub deleted file mode 100644 index a670bb3..0000000 --- a/templates/default-collective/controller-constructor.stub +++ /dev/null @@ -1,10 +0,0 @@ - /** - * Create a new controller instance. - * - * @return void - */ - public function __construct() - { - [% auth_middleware %] - } - \ No newline at end of file diff --git a/templates/default-collective/controller-getdata-method-5.5.stub b/templates/default-collective/controller-getdata-method-5.5.stub deleted file mode 100644 index 3295ab8..0000000 --- a/templates/default-collective/controller-getdata-method-5.5.stub +++ /dev/null @@ -1,21 +0,0 @@ - - /** - * Get the request's data from the request. - * - * [% request_name_comment %] - * @return array - */ - [% visibility_level %] function getData([% type_hinted_request_name %]) - { - $rules = [ - [% validation_rules %] - ]; - - [% file_validation_snippet %] - $data = [% request_variable %]->validate($rules); - -[% file_snippet %] -[% boolean_snippet %] -[% string_to_null_snippet %] - return $data; - } \ No newline at end of file diff --git a/templates/default-collective/controller-getdata-method.stub b/templates/default-collective/controller-getdata-method.stub deleted file mode 100644 index f35cf67..0000000 --- a/templates/default-collective/controller-getdata-method.stub +++ /dev/null @@ -1,15 +0,0 @@ - - /** - * Get the request's data from the request. - * - * [% request_name_comment %] - * @return array - */ - [% visibility_level %] function getData([% type_hinted_request_name %]) - { - $data = [% request_variable %]->only([% fillable %]); -[% file_snippet %] -[% boolean_snippet %] -[% string_to_null_snippet %] - return $data; - } \ No newline at end of file diff --git a/templates/default-collective/controller-upload-method-5.3.stub b/templates/default-collective/controller-upload-method-5.3.stub deleted file mode 100644 index 69c3e91..0000000 --- a/templates/default-collective/controller-upload-method-5.3.stub +++ /dev/null @@ -1,20 +0,0 @@ - - /** - * Moves the attached file to the server. - * - * @param Symfony\Component\HttpFoundation\File\UploadedFile $file - * - * @return string - */ - protected function moveFile($file) - { - if (!$file->isValid()) { - return ''; - } - - $fileName = sprintf('%s.%s', uniqid(), $file->getClientOriginalExtension()); - $destinationPath = config('laravel-code-generator.files_upload_path','uploads'); - $path = $file->move($destinationPath, $fileName); - - return $destinationPath . '/' . $fileName; - } \ No newline at end of file diff --git a/templates/default-collective/controller-upload-method.stub b/templates/default-collective/controller-upload-method.stub deleted file mode 100644 index 69c3e91..0000000 --- a/templates/default-collective/controller-upload-method.stub +++ /dev/null @@ -1,20 +0,0 @@ - - /** - * Moves the attached file to the server. - * - * @param Symfony\Component\HttpFoundation\File\UploadedFile $file - * - * @return string - */ - protected function moveFile($file) - { - if (!$file->isValid()) { - return ''; - } - - $fileName = sprintf('%s.%s', uniqid(), $file->getClientOriginalExtension()); - $destinationPath = config('laravel-code-generator.files_upload_path','uploads'); - $path = $file->move($destinationPath, $fileName); - - return $destinationPath . '/' . $fileName; - } \ No newline at end of file diff --git a/templates/default-collective/controller.stub b/templates/default-collective/controller.stub deleted file mode 100644 index cbe851c..0000000 --- a/templates/default-collective/controller.stub +++ /dev/null @@ -1,138 +0,0 @@ -route('[% index_route_name %]') - ->with('success_message', [% model_was_added %]); - } catch (Exception $exception) { - - return back()->withInput() - ->withErrors(['unexpected_error' => [% unexpected_error %]]); - } - } - - /** - * Display the specified [% model_name %]. - * - * @param int $id - * - * @return Illuminate\View\View - */ - public function show($id) - { - $[% model_name_singular_variable %] = [% model_name_class %]::[% with_relations_for_show %]findOrFail($id); - - return view('[% show_view_name %]'[% view_variables_for_show %]); - } - - /** - * Show the form for editing the specified [% model_name %]. - * - * @param int $id - * - * @return Illuminate\View\View - */ - public function edit($id) - { - $[% model_name_singular_variable %] = [% model_name_class %]::findOrFail($id); - [% relation_collections %] - - return view('[% edit_view_name %]'[% view_variables_for_edit %]); - } - - /** - * Update the specified [% model_name %] in the storage. - * - * @param int $id - * @param [% request_fullname %] [% request_variable %] - * - * @return Illuminate\Http\RedirectResponse | Illuminate\Routing\Redirector - */ - public function update($id, [% type_hinted_request_name %]) - { - try { - [% call_affirm %] - $[% data_variable %] = [% call_get_data %]; - [% on_update_setter %] - $[% model_name_singular_variable %] = [% model_name_class %]::findOrFail($id); - $[% model_name_singular_variable %]->update($[% data_variable %]); - - return redirect()->route('[% index_route_name %]') - ->with('success_message', [% model_was_updated %]); - } catch (Exception $exception) { - - return back()->withInput() - ->withErrors(['unexpected_error' => [% unexpected_error %]]); - } - } - - /** - * Remove the specified [% model_name %] from the storage. - * - * @param int $id - * - * @return Illuminate\Http\RedirectResponse | Illuminate\Routing\Redirector - */ - public function destroy($id) - { - try { - $[% model_name_singular_variable %] = [% model_name_class %]::findOrFail($id); - $[% model_name_singular_variable %]->delete(); - - return redirect()->route('[% index_route_name %]') - ->with('success_message', [% model_was_deleted %]); - } catch (Exception $exception) { - - return back()->withInput() - ->withErrors(['unexpected_error' => [% unexpected_error %]]); - } - } -[% affirm_method %] -[% get_data_method %] -[% upload_method %] -} diff --git a/templates/default-collective/create.blade.stub b/templates/default-collective/create.blade.stub deleted file mode 100644 index be65568..0000000 --- a/templates/default-collective/create.blade.stub +++ /dev/null @@ -1,56 +0,0 @@ -@extends('[% layout_name %]') - -@section('content') - -
    - -
    - -
    -

    [% create_model %]

    -
    - -
    - - - - - -
    - -
    - -
    - - @if ($errors->any()) - - @endif - - {!! Form::open([ - 'route' => '[% store_route_name %]', - 'class' => 'form-horizontal', - 'name' => '[% form_name %]', - 'id' => '[% form_id %]', - [% upload_files %] - ]) - !!} - - @include ('[% form_view_name %]', ['[% model_name_singular_variable %]' => null,]) -
    -
    - {!! Form::submit([% add %], ['class' => 'btn btn-primary']) !!} -
    -
    - - {!! Form::close() !!} - -
    -
    - -@endsection - - diff --git a/templates/default-collective/edit.blade.stub b/templates/default-collective/edit.blade.stub deleted file mode 100644 index 3dcc739..0000000 --- a/templates/default-collective/edit.blade.stub +++ /dev/null @@ -1,58 +0,0 @@ -@extends('[% layout_name %]') - -@section('content') - -
    - -
    - -
    -

    {{ !empty([% model_header %]) ? [% model_header %] : '[% model_name_title %]' }}

    -
    - -
    - - - - - - - - - -
    -
    - -
    - - @if ($errors->any()) - - @endif - - {!! Form::model($[% model_name_singular_variable %], [ - 'method' => 'PUT', - 'route' => ['[% update_route_name %]', $[% model_name_singular_variable %]->[% primary_key %]], - 'class' => 'form-horizontal', - 'name' => '[% form_name %]', - 'id' => '[% form_id %]', - [% upload_files %] - ]) !!} - - @include ('[% form_view_name %]', ['[% model_name_singular_variable %]' => $[% model_name_singular_variable %],]) - -
    -
    - {!! Form::submit([% update %], ['class' => 'btn btn-primary']) !!} -
    -
    - - {!! Form::close() !!} - -
    -
    - -@endsection \ No newline at end of file diff --git a/templates/default-collective/form-file-field.blade.stub b/templates/default-collective/form-file-field.blade.stub deleted file mode 100644 index f986e18..0000000 --- a/templates/default-collective/form-file-field.blade.stub +++ /dev/null @@ -1,20 +0,0 @@ -
    - - -
    - - @if (isset($[% model_name_singular_variable %]->[% field_name %]) && !empty($[% model_name_singular_variable %]->[% field_name %])) -
    - - Delete - - - - {{ [% field_value %] }} - -
    - @endif \ No newline at end of file diff --git a/templates/default-collective/form-helper-field.blade.stub b/templates/default-collective/form-helper-field.blade.stub deleted file mode 100644 index 51928cb..0000000 --- a/templates/default-collective/form-helper-field.blade.stub +++ /dev/null @@ -1 +0,0 @@ - {!! $errors->first('[% field_name %]', '

    :message

    ') !!} \ No newline at end of file diff --git a/templates/default-collective/form-input-field.blade.stub b/templates/default-collective/form-input-field.blade.stub deleted file mode 100644 index d37139b..0000000 --- a/templates/default-collective/form-input-field.blade.stub +++ /dev/null @@ -1 +0,0 @@ - {!! Form::[% field_type %]('[% field_name %]',[% field_value %], ['class' => 'form-control[% css_class %]',[% min_length %][% max_length %][% min_value %][% max_value %][% required_field %][% placeholder %][% step %] ]) !!} \ No newline at end of file diff --git a/templates/default-collective/form-input-wrapper.blade.stub b/templates/default-collective/form-input-wrapper.blade.stub deleted file mode 100644 index 23c42f3..0000000 --- a/templates/default-collective/form-input-wrapper.blade.stub +++ /dev/null @@ -1,8 +0,0 @@ - -
    -[% field_label %] -
    -[% field_input %] -[% field_validation_helper %] -
    -
    diff --git a/templates/default-collective/form-label-field.blade.stub b/templates/default-collective/form-label-field.blade.stub deleted file mode 100644 index 5ae8c70..0000000 --- a/templates/default-collective/form-label-field.blade.stub +++ /dev/null @@ -1 +0,0 @@ - {!! Form::label('[% field_name %]',[% field_title %],['class' => 'col-md-2 control-label']) !!} \ No newline at end of file diff --git a/templates/default-collective/form-month-field.blade.stub b/templates/default-collective/form-month-field.blade.stub deleted file mode 100644 index 4e7cde7..0000000 --- a/templates/default-collective/form-month-field.blade.stub +++ /dev/null @@ -1 +0,0 @@ - {!! Form::selectMonth('[% field_name %]', [% selected_value %], ['class' => 'form-control[% css_class %]']) !!} \ No newline at end of file diff --git a/templates/default-collective/form-nolabel-field.blade.stub b/templates/default-collective/form-nolabel-field.blade.stub deleted file mode 100644 index 78460f9..0000000 --- a/templates/default-collective/form-nolabel-field.blade.stub +++ /dev/null @@ -1 +0,0 @@ -
    \ No newline at end of file diff --git a/templates/default-collective/form-password-field.blade.stub b/templates/default-collective/form-password-field.blade.stub deleted file mode 100644 index 808d487..0000000 --- a/templates/default-collective/form-password-field.blade.stub +++ /dev/null @@ -1 +0,0 @@ - {!! Form::[% field_type %]('[% field_name %]', ['class' => 'form-control[% css_class %]',[% min_length %][% max_length %][% min_value %][% max_value %][% required_field %][% placeholder %] ]) !!} \ No newline at end of file diff --git a/templates/default-collective/form-pickitems-field.blade.stub b/templates/default-collective/form-pickitems-field.blade.stub deleted file mode 100644 index d15e520..0000000 --- a/templates/default-collective/form-pickitems-field.blade.stub +++ /dev/null @@ -1,6 +0,0 @@ -
    - -
    \ No newline at end of file diff --git a/templates/default-collective/form-pickitems-inline-field.blade.stub b/templates/default-collective/form-pickitems-inline-field.blade.stub deleted file mode 100644 index e594e19..0000000 --- a/templates/default-collective/form-pickitems-inline-field.blade.stub +++ /dev/null @@ -1,4 +0,0 @@ - diff --git a/templates/default-collective/form-request.stub b/templates/default-collective/form-request.stub deleted file mode 100644 index 22ecfd7..0000000 --- a/templates/default-collective/form-request.stub +++ /dev/null @@ -1,35 +0,0 @@ - 'form-control[% css_class %]',[% field_multiple %][% required_field %][% placeholder %] ]) !!} \ No newline at end of file diff --git a/templates/default-collective/form-selectrange-field.blade.stub b/templates/default-collective/form-selectrange-field.blade.stub deleted file mode 100644 index 65065b5..0000000 --- a/templates/default-collective/form-selectrange-field.blade.stub +++ /dev/null @@ -1 +0,0 @@ - {!! Form::selectRange('[% field_name %]', [% min_value %], [% max_value %], [% selected_value %], ['class' => 'form-control[% css_class %]']) !!} \ No newline at end of file diff --git a/templates/default-collective/form-textarea-field.blade.stub b/templates/default-collective/form-textarea-field.blade.stub deleted file mode 100644 index aaebc0a..0000000 --- a/templates/default-collective/form-textarea-field.blade.stub +++ /dev/null @@ -1 +0,0 @@ - {!! Form::textarea('[% field_name %]', [% field_value %], ['class' => 'form-control[% css_class %]',[% min_length %][% max_length %][% min_value %][% max_value %][% required_field %][% placeholder %] ]) !!} \ No newline at end of file diff --git a/templates/default-collective/form.blade.stub b/templates/default-collective/form.blade.stub deleted file mode 100644 index ad6d762..0000000 --- a/templates/default-collective/form.blade.stub +++ /dev/null @@ -1 +0,0 @@ -[% form_fields_html %] diff --git a/templates/default-collective/index.blade.stub b/templates/default-collective/index.blade.stub deleted file mode 100644 index 769cc6e..0000000 --- a/templates/default-collective/index.blade.stub +++ /dev/null @@ -1,96 +0,0 @@ -@extends('[% layout_name %]') - -@section('content') - - @if(Session::has('success_message')) -
    - - {!! session('success_message') !!} - - - -
    - @endif - -
    - -
    - -
    -

    [% model_name_plural_title %]

    -
    - -
    - - - - - -
    - -
    - - @if(count($[% model_name_plural_variable %]) == 0) -
    -

    [% no_models_available %]

    -
    - @else -
    -
    - - - - -[% header_cells %] - - - - - @foreach($[% model_name_plural_variable %] as $[% model_name_singular_variable %]) - -[% body_cells %] - - - @endforeach - -
    - - {!! Form::open([ - 'method' =>'DELETE', - 'route' => ['[% destroy_route_name %]', $[% model_name_singular_variable %]->[% primary_key %]], - 'style' => 'display: inline;', - ]) !!} -
    - - - - - - - - {!! Form::button('', - [ - 'type' => 'submit', - 'class' => 'btn btn-danger', - 'title' => [% delete_model %], - 'onclick' => 'return confirm("' . [% confirm_delete %] . '")' - ]) - !!} -
    - {!! Form::close() !!} -
    - -
    - -
    - - - - @endif - -
    -@endsection \ No newline at end of file diff --git a/templates/default-collective/index.body.cell.blade.stub b/templates/default-collective/index.body.cell.blade.stub deleted file mode 100644 index 55cb084..0000000 --- a/templates/default-collective/index.body.cell.blade.stub +++ /dev/null @@ -1 +0,0 @@ - {{ [% field_value %] }} \ No newline at end of file diff --git a/templates/default-collective/index.header.cell.blade.stub b/templates/default-collective/index.header.cell.blade.stub deleted file mode 100644 index 8ca0b94..0000000 --- a/templates/default-collective/index.header.cell.blade.stub +++ /dev/null @@ -1 +0,0 @@ - [% field_title %] \ No newline at end of file diff --git a/templates/default-collective/language.stub b/templates/default-collective/language.stub deleted file mode 100644 index 4a711de..0000000 --- a/templates/default-collective/language.stub +++ /dev/null @@ -1,5 +0,0 @@ - - - - - - - - {{ config('app.name', '[% application_name %]') }} - - - - - {{-- --}} - - - - - - - - - -
    - @yield('content') -
    - - - - - - {{-- --}} - - - - diff --git a/templates/default-collective/layout.stub b/templates/default-collective/layout.stub deleted file mode 100644 index 3b78180..0000000 --- a/templates/default-collective/layout.stub +++ /dev/null @@ -1,149 +0,0 @@ - - - - - - - - {{ config('app.name', '[% application_name %]') }} - - - - - {{-- --}} - - - - - - - - - -
    - @yield('content') -
    - - - - - {{-- --}} - - - - diff --git a/templates/default-collective/login-partial.stub b/templates/default-collective/login-partial.stub deleted file mode 100644 index 86f73df..0000000 --- a/templates/default-collective/login-partial.stub +++ /dev/null @@ -1,10 +0,0 @@ -@if (Route::has('login')) - -@endif \ No newline at end of file diff --git a/templates/default-collective/migration-schema-down.stub b/templates/default-collective/migration-schema-down.stub deleted file mode 100644 index 22fa175..0000000 --- a/templates/default-collective/migration-schema-down.stub +++ /dev/null @@ -1 +0,0 @@ -Schema::[% connection_name %]drop('[% table_name %]'); \ No newline at end of file diff --git a/templates/default-collective/migration-schema-up.stub b/templates/default-collective/migration-schema-up.stub deleted file mode 100644 index 871cdc3..0000000 --- a/templates/default-collective/migration-schema-up.stub +++ /dev/null @@ -1,4 +0,0 @@ -Schema::[% connection_name %][% operation_name %]('[% table_name %]', function(Blueprint $table) - { -[% blue_print_body %] - }); \ No newline at end of file diff --git a/templates/default-collective/migration.stub b/templates/default-collective/migration.stub deleted file mode 100644 index 43bfce1..0000000 --- a/templates/default-collective/migration.stub +++ /dev/null @@ -1,27 +0,0 @@ -attributes['[% field_name %]'] = !empty($value) ? \DateTime::createFromFormat($this->getDateFormat(), $value) : null; \ No newline at end of file diff --git a/templates/default-collective/model-mutator-multiple-answers.stub b/templates/default-collective/model-mutator-multiple-answers.stub deleted file mode 100644 index 0da4880..0000000 --- a/templates/default-collective/model-mutator-multiple-answers.stub +++ /dev/null @@ -1 +0,0 @@ -$this->attributes['[% field_name %]'] = json_encode($value); \ No newline at end of file diff --git a/templates/default-collective/model-mutator.stub b/templates/default-collective/model-mutator.stub deleted file mode 100644 index fc8eae0..0000000 --- a/templates/default-collective/model-mutator.stub +++ /dev/null @@ -1,10 +0,0 @@ - /** - * Set the [% field_name %]. - * - * @param string $value - * @return void - */ - public function set[% field_name_cap %]Attribute($value) - { - [% content %] - } diff --git a/templates/default-collective/model-primary-key.stub b/templates/default-collective/model-primary-key.stub deleted file mode 100644 index 925b8ea..0000000 --- a/templates/default-collective/model-primary-key.stub +++ /dev/null @@ -1,6 +0,0 @@ - /** - * The database primary key value. - * - * @var string - */ - protected $primaryKey = '[% primary_key %]'; \ No newline at end of file diff --git a/templates/default-collective/model-relation.stub b/templates/default-collective/model-relation.stub deleted file mode 100644 index 0ce8050..0000000 --- a/templates/default-collective/model-relation.stub +++ /dev/null @@ -1,9 +0,0 @@ - /** - * Get the [% relation_name %] for this model. - * - * @return [% relation_return_type %] - */ - public function [% relation_name %]() - { - return $this->[% relation_type %]([% relation_params %]); - } diff --git a/templates/default-collective/model-timestamps.stub b/templates/default-collective/model-timestamps.stub deleted file mode 100644 index ca00793..0000000 --- a/templates/default-collective/model-timestamps.stub +++ /dev/null @@ -1,6 +0,0 @@ - /** - * Indicates if the model should be timestamped. - * - * @var bool - */ - public $timestamps = false; \ No newline at end of file diff --git a/templates/default-collective/model.stub b/templates/default-collective/model.stub deleted file mode 100644 index e247af6..0000000 --- a/templates/default-collective/model.stub +++ /dev/null @@ -1,44 +0,0 @@ -name('[% index_route_name %]'); - Route::get('/create', [[% controller_name %]::class, 'create']) - ->name('[% create_route_name %]'); - Route::get('/show/{[% model_name_singular_variable %]}',[[% controller_name %]::class, 'show']) - ->name('[% show_route_name %]')[% route_id_clause %]; - Route::get('/{[% model_name_singular_variable %]}/edit',[[% controller_name %]::class, 'edit']) - ->name('[% edit_route_name %]')[% route_id_clause %]; - Route::post('/', [[% controller_name %]::class, 'store']) - ->name('[% store_route_name %]'); - Route::put('[% model_name_snake %]/{[% model_name_singular_variable %]}', [[% controller_name %]::class, 'update']) - ->name('[% update_route_name %]')[% route_id_clause %]; - Route::delete('/[% model_name_snake %]/{[% model_name_singular_variable %]}',[[% controller_name %]::class, 'destroy']) - ->name('[% destroy_route_name %]')[% route_id_clause %]; \ No newline at end of file diff --git a/templates/default-collective/routes-group.stub b/templates/default-collective/routes-group.stub deleted file mode 100644 index 23a1f20..0000000 --- a/templates/default-collective/routes-group.stub +++ /dev/null @@ -1,6 +0,0 @@ - -Route::group([ - [% prefix %] -], function () { -[% routes %] -}); diff --git a/templates/default-collective/routes.stub b/templates/default-collective/routes.stub deleted file mode 100644 index 615d786..0000000 --- a/templates/default-collective/routes.stub +++ /dev/null @@ -1,14 +0,0 @@ - Route::get('/', '[% controller_name %]@index') - ->name('[% index_route_name %]'); - Route::get('/create','[% controller_name %]@create') - ->name('[% create_route_name %]'); - Route::get('/show/{[% model_name_singular_variable %]}','[% controller_name %]@show') - ->name('[% show_route_name %]')[% route_id_clause %]; - Route::get('/{[% model_name_singular_variable %]}/edit','[% controller_name %]@edit') - ->name('[% edit_route_name %]')[% route_id_clause %]; - Route::post('/', '[% controller_name %]@store') - ->name('[% store_route_name %]'); - Route::put('[% model_name_snake %]/{[% model_name_singular_variable %]}', '[% controller_name %]@update') - ->name('[% update_route_name %]')[% route_id_clause %]; - Route::delete('/[% model_name_snake %]/{[% model_name_singular_variable %]}','[% controller_name %]@destroy') - ->name('[% destroy_route_name %]')[% route_id_clause %]; \ No newline at end of file diff --git a/templates/default-collective/show.blade.stub b/templates/default-collective/show.blade.stub deleted file mode 100644 index 34a4698..0000000 --- a/templates/default-collective/show.blade.stub +++ /dev/null @@ -1,54 +0,0 @@ -@extends('[% layout_name %]') - -@section('content') - -
    -
    - -
    -

    {{ isset([% model_header %]) ? [% model_header %] : '[% model_name_title %]' }}

    -
    - -
    - - {!! Form::open([ - 'method' =>'DELETE', - 'route' => ['[% destroy_route_name %]', $[% model_name_singular_variable %]->[% primary_key %]] - ]) !!} -
    - - - - - - - - - - - - - {!! Form::button('', - [ - 'type' => 'submit', - 'class' => 'btn btn-danger', - 'title' => [% delete_model %], - 'onclick' => 'return confirm("' . [% confirm_delete %] . '")' - ]) - !!} -
    - {!! Form::close() !!} - -
    - -
    - -
    -
    -[% table_rows %] -
    - -
    -
    - -@endsection \ No newline at end of file diff --git a/templates/default-collective/show.row.blade.stub b/templates/default-collective/show.row.blade.stub deleted file mode 100644 index bddf14d..0000000 --- a/templates/default-collective/show.row.blade.stub +++ /dev/null @@ -1,2 +0,0 @@ -
    [% field_title %]
    -
    {{ [% field_value %] }}
    \ No newline at end of file diff --git a/templates/default-collective/view-model.stub b/templates/default-collective/view-model.stub deleted file mode 100644 index d861db4..0000000 --- a/templates/default-collective/view-model.stub +++ /dev/null @@ -1,30 +0,0 @@ -

    [% available_resources %]

    -
    -
    - -
    -
    GET
    - /{{ Route::getRoutes()->getByName('[% index_route_name %]')->uri() }} - [% index_route_description %] -
    -
    - - - -
    +
    +
    +
    + GET + /{{ Route::getRoutes()->getByName('[% index_route_name %]')->uri() }} +

    [% index_route_description %]

    - -
    -
    -

    [% request_title %]

    - [% authorized_request_for_index %] - -
    -

    [% response_title %]

    - -

    [% index_route_response_description %]

    -

    - -

    200 - Ok

    -

    [% request_was_successful %]

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    success[% boolean_title %]Was the request successful or not.
    message[% string_title %][% the_success_message %]
    data[% array_title %] - [% the_key_is_the_model_property_and_the_value_is_the_model_value %] -
    links[% array_title %] - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    [% key_title %][% data_type_title %][% description_title %]
    first[% string_title %][% link_to_retrieve_first_page %]
    last[% string_title %][% link_to_retrieve_last_page %]
    prev[% string_title %][% link_to_retrieve_previous_page %]
    next[% string_title %][% link_to_retrieve_next_page %]
    - -
    meta[% array_title %] - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    [% key_title %][% data_type_title %][% description_title %]
    current_page[% integer_title %][% the_number_of_current_page %]
    from[% integer_title %][% the_index_of_the_first_retrieved_item %]
    last_page[% integer_title %][% the_number_of_the_last_page %]
    Path[% string_title %][% the_base_link_to_the_resource %]
    per_page[% integer_title %][% the_number_of_models_per_page %]
    to[% integer_title %][% the_index_of_the_last_retrieved_item %]
    total[% integer_title %][% the_total_of_available_pages %]
    - -
    - - [% include_failed_authentication_for_authorized_request %] - -
    +
    +
    +
    +

    [% request_title %]

    + [% authorized_request_for_index %] + +
    +

    [% response_title %]

    + +

    [% index_route_response_description %]

    +

    + +

    200 - Ok

    +

    [% request_was_successful %]

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    success[% boolean_title %]Was the request successful or not.
    message[% string_title %][% the_success_message %]
    data[% array_title %] + [% the_key_is_the_model_property_and_the_value_is_the_model_value %] +
    links[% array_title %] + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    [% key_title %][% data_type_title %][% description_title %]
    first[% string_title %][% link_to_retrieve_first_page %]
    last[% string_title %][% link_to_retrieve_last_page %]
    prev[% string_title %][% link_to_retrieve_previous_page %]
    next[% string_title %][% link_to_retrieve_next_page %]
    + +
    meta[% array_title %] + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    [% key_title %][% data_type_title %][% description_title %]
    current_page[% integer_title %][% the_number_of_current_page %]
    from[% integer_title %][% the_index_of_the_first_retrieved_item %]
    last_page[% integer_title %][% the_number_of_the_last_page %]
    Path[% string_title %][% the_base_link_to_the_resource %]
    per_page[% integer_title %][% the_number_of_models_per_page %]
    to[% integer_title %][% the_index_of_the_last_retrieved_item %]
    total[% integer_title %][% the_total_of_available_pages %]
    + +
    + + [% include_failed_authentication_for_authorized_request %] -
    -
    - -
    -
    POST
    - /{{ Route::getRoutes()->getByName('[% store_route_name %]')->uri() }} - [% store_route_description %] -
    -
    +
    +
    - -
    +
    +
    +
    + POST + /{{ Route::getRoutes()->getByName('[% store_route_name %]')->uri() }} +

    [% store_route_description %]

    - -
    -
    -

    [% request_title %]

    - - @include('[% path_to_view_home %]fields-list', [ - 'withValidation' => true - ]) - -
    -

    [% response_title %]

    -

    [% store_route_response_description %]

    -

    - - @include('[% path_to_view_home %]retrieved') - @include('[% path_to_view_home %]failed-to-retrieve') - @include('[% path_to_view_home %]failed-validation') - [% include_failed_authentication_for_authorized_request %] - -
    +
    +
    +
    +

    [% request_title %]

    + + @include('[% path_to_view_home %]fields-list', [ + 'withValidation' => true + ]) +
    +

    [% response_title %]

    +

    [% store_route_response_description %]

    +

    -
    -
    + @include('[% path_to_view_home %]retrieved') + @include('[% path_to_view_home %]failed-to-retrieve') + @include('[% path_to_view_home %]failed-validation') + [% include_failed_authentication_for_authorized_request %] + +
    +
    -
    -
    POST
    - /{{ Route::getRoutes()->getByName('[% update_route_name %]')->uri() }} - [% update_route_description %] -
    -
    - -
    +
    +
    +
    + POST + /{{ Route::getRoutes()->getByName('[% update_route_name %]')->uri() }} +

    [% update_route_description %]

    +
    +
    +
    +
    -
    -
    +
    +
    -

    [% request_title %]

    +

    [% request_title %]

    - @include('[% path_to_view_home %]fields-list', [ - 'withValidation' => true, - 'withPathId' => true, - ]) + @include('[% path_to_view_home %]fields-list', [ + 'withValidation' => true, + 'withPathId' => true, + ]) -
    -

    [% response_title %]

    -

    [% update_route_response_description %]

    -

    - - @include('[% path_to_view_home %]retrieved') - @include('[% path_to_view_home %]failed-to-retrieve') - @include('[% path_to_view_home %]failed-validation') - [% include_failed_authentication_for_authorized_request %] +
    +

    [% response_title %]

    +

    [% update_route_response_description %]

    +

    + + @include('[% path_to_view_home %]retrieved') + @include('[% path_to_view_home %]failed-to-retrieve') + @include('[% path_to_view_home %]failed-validation') + [% include_failed_authentication_for_authorized_request %] -
    +
    -
    -
    - -
    -
    GET
    - /{{ Route::getRoutes()->getByName('[% show_route_name %]')->uri() }} - [% show_route_description %] -
    -
    - - - - -
    +
    +
    +
    + GET + /{{ Route::getRoutes()->getByName('[% show_route_name %]')->uri() }} +

    [% show_route_description %]

    - -
    -
    - -

    [% request_title %]

    - - - - - - - - - - - - [% include_parameter_for_authorized_request %] - - - - - - - -
    [% parameter_name_title %][% data_type_title %][% parameter_type_title %][% description_title %]
    [% model_name %][% integer_title %][% path_title %][% the_id_of_model_to_retrieve %]
    - - -
    -

    [% response_title %]

    -

    [% show_route_response_description %]

    -

    - - @include('[% path_to_view_home %]retrieved') - @include('[% path_to_view_home %]failed-to-retrieve') - [% include_failed_authentication_for_authorized_request %] - -
    +
    +
    +
    + +

    [% request_title %]

    + + + + + + + + + + + + [% include_parameter_for_authorized_request %] + + + + + + + +
    [% parameter_name_title %][% data_type_title %][% parameter_type_title %][% description_title %]
    [% model_name %][% integer_title %][% path_title %][% the_id_of_model_to_retrieve %]
    + + +
    +

    [% response_title %]

    +

    [% show_route_response_description %]

    +

    + + @include('[% path_to_view_home %]retrieved') + @include('[% path_to_view_home %]failed-to-retrieve') + [% include_failed_authentication_for_authorized_request %] +
    +
    -
    -
    - -
    -
    DELETE
    - /{{ Route::getRoutes()->getByName('[% destroy_route_name %]')->uri() }} - [% destroy_route_description %] -
    -
    - - -
    +
    +
    +
    + DELETE + /{{ Route::getRoutes()->getByName('[% destroy_route_name %]')->uri() }} +

    [% destroy_route_description %]

    - -
    -
    - -

    [% request_title %]

    - - - - - - - - - - - - [% include_parameter_for_authorized_request %] - - - - - - - -
    [% parameter_name_title %][% data_type_title %][% parameter_type_title %][% description_title %]
    [% model_name %][% integer_title %][% path_title %][% the_id_of_model_to_delete %]
    - - -
    -

    [% response_title %]

    -

    [% destroy_route_response_description %]

    -

    - - @include('[% path_to_view_home %]retrieved') - @include('[% path_to_view_home %]failed-to-retrieve') - [% include_failed_authentication_for_authorized_request %] - -
    +
    +
    -
    +
    + +

    [% request_title %]

    + + + + + + + + + + + + [% include_parameter_for_authorized_request %] + + + + + + + +
    [% parameter_name_title %][% data_type_title %][% parameter_type_title %][% description_title %]
    [% model_name %][% integer_title %][% path_title %][% the_id_of_model_to_delete %]
    + + +
    +

    [% response_title %]

    +

    [% destroy_route_response_description %]

    +

    + + @include('[% path_to_view_home %]retrieved') + @include('[% path_to_view_home %]failed-to-retrieve') + [% include_failed_authentication_for_authorized_request %] -

    [% model_definition_title %]

    -
    -
    +
    -
    - [% model_name_title %] -
    -
    +
    - +
    -
    +

    [% model_definition_title %]

    +
    +
    +
    + [% model_name_title %]
    - -
    -
    - - - - - - - - - - [% fields_list_for_body %] - -
    [% field_name_title %][% field_type_title %][% description_title %]
    -
    +
    +
    -
    +
    + + + + + + + + + + [% fields_list_for_body %] + +
    [% field_name_title %][% field_type_title %][% description_title %]
    +
    +
    @endsection diff --git a/templates/default/controller.stub b/templates/default/controller.stub index bbdb6b6..fbd784e 100644 --- a/templates/default/controller.stub +++ b/templates/default/controller.stub @@ -41,19 +41,13 @@ class [% controller_name %] [% controller_extends %] */ public function store([% type_hinted_request_name %]) { - try { - [% call_affirm %] - $[% data_variable %] = [% call_get_data %]; - [% on_store_setter %] - [% model_name_class %]::create($[% data_variable %]); - - return redirect()->route('[% index_route_name %]') - ->with('success_message', [% model_was_added %]); - } catch (Exception $exception) { + [% call_affirm %] + $[% data_variable %] = [% call_get_data %]; + [% on_store_setter %] + [% model_name_class %]::create($[% data_variable %]); - return back()->withInput() - ->withErrors(['unexpected_error' => [% unexpected_error %]]); - } + return redirect()->route('[% index_route_name %]') + ->with('success_message', [% model_was_added %]); } /** @@ -95,20 +89,14 @@ class [% controller_name %] [% controller_extends %] */ public function update($id, [% type_hinted_request_name %]) { - try { - [% call_affirm %] - $[% data_variable %] = [% call_get_data %]; - [% on_update_setter %] - $[% model_name_singular_variable %] = [% model_name_class %]::findOrFail($id); - $[% model_name_singular_variable %]->update($[% data_variable %]); - - return redirect()->route('[% index_route_name %]') - ->with('success_message', [% model_was_updated %]); - } catch (Exception $exception) { + [% call_affirm %] + $[% data_variable %] = [% call_get_data %]; + [% on_update_setter %] + $[% model_name_singular_variable %] = [% model_name_class %]::findOrFail($id); + $[% model_name_singular_variable %]->update($[% data_variable %]); - return back()->withInput() - ->withErrors(['unexpected_error' => [% unexpected_error %]]); - } + return redirect()->route('[% index_route_name %]') + ->with('success_message', [% model_was_updated %]); } /** diff --git a/templates/default/create.blade.stub b/templates/default/create.blade.stub index 3c274ec..ac5dfc4 100644 --- a/templates/default/create.blade.stub +++ b/templates/default/create.blade.stub @@ -2,42 +2,38 @@ @section('content') -
    +
    -
    - - -

    [% create_model %]

    -
    - -
    +
    +

    [% create_model %]

    + -
    + -
    +
    @if ($errors->any()) -
      - @foreach ($errors->all() as $error) -
    • {{ $error }}
    • - @endforeach -
    + @endif -
    + {{ csrf_field() }} @include ('[% form_view_name %]', [ '[% model_name_singular_variable %]' => null, ]) -
    -
    - -
    +
    +
    diff --git a/templates/default/edit.blade.stub b/templates/default/edit.blade.stub index ef0e382..081642d 100644 --- a/templates/default/edit.blade.stub +++ b/templates/default/edit.blade.stub @@ -2,47 +2,42 @@ @section('content') -
    +
    -
    - -
    -

    {{ !empty([% model_header %]) ? [% model_header %] : '[% model_name_title %]' }}

    -
    -
    - +
    +

    {{ !empty([% model_header %]) ? [% model_header %] : '[% model_name_title %]' }}

    +
    -
    +
    @if ($errors->any()) -
      - @foreach ($errors->all() as $error) -
    • {{ $error }}
    • - @endforeach -
    + @endif -
    + {{ csrf_field() }} @include ('[% form_view_name %]', [ '[% model_name_singular_variable %]' => $[% model_name_singular_variable %], ]) -
    -
    - -
    +
    +
    diff --git a/templates/default/form-file-field.blade.stub b/templates/default/form-file-field.blade.stub index f986e18..06fe6cf 100644 --- a/templates/default/form-file-field.blade.stub +++ b/templates/default/form-file-field.blade.stub @@ -1,20 +1,14 @@ -
    - - +
    +
    @if (isset($[% model_name_singular_variable %]->[% field_name %]) && !empty($[% model_name_singular_variable %]->[% field_name %])) -
    - - Delete - - - {{ [% field_value %] }} - -
    - @endif \ No newline at end of file +
    +
    + +
    + +
    + + @endif diff --git a/templates/default/form-helper-field.blade.stub b/templates/default/form-helper-field.blade.stub index 51928cb..d34652f 100644 --- a/templates/default/form-helper-field.blade.stub +++ b/templates/default/form-helper-field.blade.stub @@ -1 +1 @@ - {!! $errors->first('[% field_name %]', '

    :message

    ') !!} \ No newline at end of file + {!! $errors->first('[% field_name %]', '
    :message
    ') !!} \ No newline at end of file diff --git a/templates/default/form-input-field.blade.stub b/templates/default/form-input-field.blade.stub index bf9e70e..fd62a05 100644 --- a/templates/default/form-input-field.blade.stub +++ b/templates/default/form-input-field.blade.stub @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/templates/default/form-input-wrapper.blade.stub b/templates/default/form-input-wrapper.blade.stub index 23c42f3..ac7c9cf 100644 --- a/templates/default/form-input-wrapper.blade.stub +++ b/templates/default/form-input-wrapper.blade.stub @@ -1,7 +1,7 @@ -
    +
    [% field_label %] -
    +
    [% field_input %] [% field_validation_helper %]
    diff --git a/templates/default/form-label-field.blade.stub b/templates/default/form-label-field.blade.stub index 73505ca..b48e5f3 100644 --- a/templates/default/form-label-field.blade.stub +++ b/templates/default/form-label-field.blade.stub @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/templates/default/form-month-field.blade.stub b/templates/default/form-month-field.blade.stub index cbe7a2c..8ba00e6 100644 --- a/templates/default/form-month-field.blade.stub +++ b/templates/default/form-month-field.blade.stub @@ -1,4 +1,4 @@ - [% placeholder %] @foreach (range(1, 12) as $value)