Stars: 673
Forks: 144
Pull Requests: 35
Issues: 157
Watchers: 38
Last Updated: 2023-09-12 01:28:52
An intelligent code generator for Laravel framework that will save you time! This awesome tool will help you generate resources like views, controllers, routes, migrations, languages and/or form-requests! It is extremely flexible and customizable to cover many of the use cases. It is shipped with cross-browsers compatible template, along with a client-side validation to modernize your application.
License: MIT License
Languages: PHP
An intelligent code generator for Laravel framework that will save you time! This awesome tool will help you generate resources like views, controllers, routes, migrations, languages and/or form-requests! It is extremely flexible and customizable to cover many on the use cases. It is shipped with cross-browsers compatible template, along with a client-side validation to modernize your application.
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.
To download this package into your laravel project, use the command-line to execute the following command
composer require crestapps/laravel-code-generator --dev
(You may skip this step when using Laravel >= 5.5) To bootstrap the packages into your project while using command-line only, open the app/Providers/AppServiceProvider.php file in your project. Then, add the following code to the register() method.
Add the following line to bootstrap laravel-code-generator to the framework.
if ($this->app->runningInConsole()) {
$this->app->register('CrestApps\CodeGenerator\CodeGeneratorServiceProvider');
}
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 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.
Checkout our channel on YouTube.com
The command in between the square brackets [] must be replaced with a variable of your choice.
Full documentation available at CrestApps.com.
Live demo is available at CrestApps.com.
codegenerator.php
file found in your config
folder, then rename the codegenerator_custom.php
file to laravel-code-generator.php
if one exists. Alternatively, you can delete both codegenerator.php
and codegenerator_custom.php
Do you like this project and want to contribute?
v2.3
needs to be documented. If you are able to contribute, please read the change-log in v2.3 branch and document it in the CrestApps-site repository. For any help, my email can be found in the composer.json
file, feel free to send me an email.I'd love to know if your site was generated using this package and list your logo on the documentation site. Please email using my contact info found in composer.json
file.
The following example assumes that we are trying to create a CRUD called AssetCategory with the fields listed below.
php artisan resource-file:create AssetCategory --fields=id,name,description,is_active
The above command will create resource-file names /resources/laravel-code-generator/sources/asset_categories.json
php artisan create:scaffold AssetCategory --with-migration
The above command will create a model app/Models/AssetCategory, a controller app/Http/Controllers/AssetCategoriesController, all views, the routes, and migration class!
php artisan create:scaffold AssetCategory --with-migration --fields=id,name,description,is_active
The above command will create resource-file names /resources/laravel-code-generator/sources/asset_categories.json first. Then, it will create a model app/Models/AssetCategory, a controller app/Http/Controllers/AssetCategoriesController, all views, the routes, and migration class!. This is a short way to issuing both `resource-file:create` and `create:scaffold` in one line
php artisan resource-file:create AssetCategory --fields=id,name,description,is_active
The above command will create resource-file names /resources/laravel-code-generator/sources/asset_categories.json
php artisan create:scaffold AssetCategory --with-migration
The above command will create a model app/Models/AssetCategory, a controller app/Http/Controllers/AssetCategoriesController, all views, the routes, and migration class!
php artisan resource-file:create AssetCategory --fields=id,name,description,is_active --translation-for=en,ar
The above command will create resource-file names /resources/laravel-code-generator/sources/asset_categories.json
php artisan create:scaffold AssetCategory --with-migration
The above command will create a model app/Models/AssetCategory, a controller app/Http/Controllers/AssetCategoriesController, all views, the routes, and migration class!
php artisan resource-file:create AssetCategory --fields=id,name,description,is_active
The above command will create resource-file names /resources/laravel-code-generator/sources/asset_categories.json
php artisan create:scaffold AssetCategory --with-form-request
The above command will create a model app/Models/AssetCategory, a controller app/Http/Controllers/AssetCategoriesController, all views, the routes, and app/Http/Requests/AssetCategoriesFormRequest class!
php artisan resource-file:create AssetCategory --fields=id,name,description,is_active
The above command will create resource-file names /resources/laravel-code-generator/sources/asset_categories.json
php artisan create:scaffold AssetCategory --with-soft-delete --with-migration
The above command will create a model app/Models/AssetCategory, a controller app/Http/Controllers/AssetCategoriesController, all views, the routes, and migration file!
php artisan create:scaffold AssetCategory --table-exists
The above command will create resource-file names /resources/laravel-code-generator/sources/asset_categories.json. It is going to assume that the table name is called "asset_categories" in your database. If that is not the case, you can use --table-name=some_other_table_name
Then it will create a model app/Models/AssetCategory, a controller app/Http/Controllers/AssetCategoriesController, all views and the routes!
You may also create a resource-file from existing database separately using
php artisan resource-file:from-database AssetCategory
php artisan create:scaffold AssetCategory --translation-for=en,ar --table-exists
The above command will create resource-file names /resources/laravel-code-generator/sources/asset_categories.json
Then it will create a model app/Models/AssetCategory, a controller app/Http/Controllers/AssetCategoriesController, all views and the routes!
You may also create a resource-file from existing database separately using
php artisan resource-file:from-database AssetCategory --translation-for=en,ar
php artisan resource-file:from-database AssetCategory --translation-for=en,ar
php artisan create:scaffold AssetCategory
The above command will create resource-file names /resources/laravel-code-generator/sources/asset_categories.json
Then it will create a model app/Models/AssetCategory, a controller app/Http/Controllers/AssetCategoriesController, all views and the routes!
"Laravel Code Generator" is an open-sourced software licensed under the MIT license