aliqsyed / scaffolder
Scaffold Controllers, Models, Factories, Policies, Requests and front-end blade files for Laravel
Requires
- doctrine/dbal: ^2.10
Requires (Dev)
- mockery/mockery: ^1.1
- orchestra/testbench: ~3|~4
- phpunit/phpunit: ^8.0
- sempro/phpunit-pretty-print: ^1.0
- spatie/phpunit-snapshot-assertions: ^3.0
- spatie/phpunit-watcher: ^1.22
This package is auto-updated.
Last update: 2024-10-30 01:31:59 UTC
README
About Scaffolder
This Laravel package scaffolds Controllers, Models, Factories, Policies, Requests and front end blade files for forms (both edit and delete), show and index views.
This package generates code. Please make sure you read the generated code and make any corrections necessary.
Compatiblity
This package works with Laravel 6.0 and above.
Installation
Via Composer
$ composer require aliqsyed/scaffolder --dev
This will add the scaffolder artisan commands to your project.
php artisan scaffolder:<scaffold-type> [tablename] [--force] [--nostubs]
Usage
You need to create and run a migration for a table. This is a mandatory step since the scoffolds for items listed above are based on the table structure.
Let's say you have created a table called posts
. You can create various classes/files as follows:
$ php artisan scaffolder:controller posts $ php artisan scaffolder:model posts $ php artisan scaffolder:factory posts $ php artisan scaffolder:policy posts $ php artisan scaffolder:request posts $ php artisan scaffolder:view posts
or you can generate all the scaffolds available at once by running the following command:
$ php artisan scaffolder:all posts
All the classes and views generated are copied to their standard Laravel locations.
Command options
--force
Use this option to overwrite an existing file.
--nostubs
Use this option to use the stubs that come with the package instead of the onces published. See information below on publishing stubs.
Additional command options for models only
If you are generating models, you can use these additional options.
--nosetters
If you use this option, the model will be created without any setters. By default there are setters for date fields.
--nocasts
If you use this option, the model will be created without any casts. By default there are casts for date fields.
Customizing the code being generated
Use the tag scaffolder.stubs
to publish stubs.
$ php artisan vendor:publish --tag=scaffolder.stubs
The publishes the stubs for scaffolder to resources/vendor/aliqsyed/stubs
folder.
Once the stubs are published, you can edit them in any way you want. Please do not delete any individual files in the stubs folder.
You can delete the resources/vendor/aliqsyed/stubs
directory, and the package will go back to using the default stubs that come with the package.
License
MIT. Please see the license file for more information.