-
Run
composer require appzcoder/crud-generator
-
Add the service provider to config/app.php.
'providers' => [ ... Appzcoder\CrudGenerator\CrudGeneratorServiceProvider::class, ],
-
Run
composer dump-autoload
-
Publish vendor files of this package. (Note: You should have configured database for this operation.)
php artisan vendor:publish --provider="Appzcoder\CrudGenerator\CrudGeneratorServiceProvider"
-
Copy the folder resources/crud-generator into your Laravel application.
-
In your laravel app, in the file config/crudgenerator.php activate custom templates:
'custom_template' => true,
Steps 7 and 8 are not a good practice, but I had no success so far in overwriting package functions the "right" way:
-
In vendor/appzcoder/crud-generator/src/Commands/CrudViewCommand.php change this line:
$labelText = "'" . ucwords(strtolower(str_replace('_', ' ', $item['name']))) . "'";
to
$labelText = ucwords(strtolower(str_replace('_', ' ', $item['name'])));
-
Again in vendor/appzcoder/crud-generator/src/Commands/CrudViewCommand.php add the following line to the function templateFormVars:
File::put($newFormFile, str_replace('%%crudNameSingular%%', $this->crudNameSingular, File::get($newFormFile)));
-
Restart your local dev server (stop running server and type php artisan serve in the terminal)
-
For more documentation and how to use, visit: https://github.com/appzcoder/crud-generator