fortytwocoders / crudy
A CRUD generator for model & resources
This package's canonical repository appears to be gone and the package has been frozen as a result.
Requires
- php: >=5.5.9
- illuminate/console: >=5.2.
- illuminate/filesystem: >=5.2.
- illuminate/support: >=5.2.
- laravelcollective/html: ^5.4.0
Requires (Dev)
- mockery/mockery: >=0.9.
- orchestra/testbench: >=3.0
- phpunit/phpunit: >=4.0
This package is not auto-updated.
Last update: 2020-12-26 07:58:18 UTC
README
This package adds the php artisan crudy command which is used to:
- Create a model with its attributes
- Create a migration for that model
- Create a controllor with index, show, edit, update, create, store and delete methods and also mapping them to their respected views
- Creates and appends routes for that model to the routes file
- Creates the views (show, create, index, edit) for the specifed model
The base of this package is @amochohan laravel-make-resource ( https://github.com/amochohan/laravel-make-resource ), so a big shoutout to him. We had a need for a package like this for our projects, so we took his already awesome package, updated it for the newest Laravel edition and added some features we needed.
Installation
Install Crudy through Composer
"require-dev": {
"fortytwocoders/crudy": "~0.2"
}
Update the config/app.php file to add the included service provider
'providers' => [
/*
* Package Service Providers...
*/
FortyTwoCoders\Crudy\CrudyServiceProvider::class,
];
And thats it, the package is now ready to be used.
This package requires
"laravelcollective/html": "^5.4.0"
for building forms in views
Using the Crudy
From the command line run:
php artisan crudy ModelName "model attributes"
The basic example would be:
php artisan crudy Test
This command will result in the following files being created:
app/Http/Test.php
app/Http/Controllers/TestController.php
database/migrations/2017_12_12_102938_create_tests_table.php
resources/views/tests/index.blade.php
resources/views/tests/create.blade.php
resources/views/tests/show.blade.php
resources/views/tests/edit.blade.php
and it will append routes for this model to
routes/web.php
(Don't worry it will not overwrite the existing routes you have saved)
An example with attributes would be
php artisan crudy Test "name:string,fillable|age:integer,fillable,unsigned|email|city:hidden"
When you want to pass attributes you do it in a pipe separated list:
{attribute name}: {comma separated properties} | {second attribute name}: { second attribute properties} | and so on...
If you specify fillable
or hidden
, the property will be set accordingly, if you neither is provided, the property isn't added to neither. Also if you don't provide a data type for your attributes they will be automatically cast to a string type