Laravel scaffold command

Hi artisans, i created a package called Laravel scaffold command, adds an artisan command that you can generate necessary files for crud applications, either you use laravel as fullstack or a rest-api this can help you.

installation

comp…


This content originally appeared on DEV Community and was authored by Tefoh

Hi artisans, i created a package called Laravel scaffold command, adds an artisan command that you can generate necessary files for crud applications, either you use laravel as fullstack or a rest-api this can help you.

installation

composer require tefoh/laravel-scaffold-command
// then
php artisan vendor:publish --tag=scaffold-stubs

Thats it and just enter the model or entity you want crud operation with the fields needed. The fields is two parts, first is field name and second is field type this two separated with a colon. The field type must be from laravel migrations available column types, heres the link https://laravel.com/docs/8.x/migrations#available-column-types. For example to create a crud operation for Category enter this:

php artisan scaffold Category --fields=name:string,slug:string,parent_id:foreignId

And for rest-api just add api parameter to create necessary resources instead of views. And controller will be a bit different:

php artisan scaffold Tag --api --fields=name:string,slug:string,parent_id:foreignId

The original idea comes from ruby on rails, they have a similar command. The beauty of this package is you can use laravel stubs and fully customize how controllers and views created when you enter this command. I hope this will be helpful for you :)


This content originally appeared on DEV Community and was authored by Tefoh


Print Share Comment Cite Upload Translate Updates
APA

Tefoh | Sciencx (2021-10-02T20:30:38+00:00) Laravel scaffold command. Retrieved from https://www.scien.cx/2021/10/02/laravel-scaffold-command/

MLA
" » Laravel scaffold command." Tefoh | Sciencx - Saturday October 2, 2021, https://www.scien.cx/2021/10/02/laravel-scaffold-command/
HARVARD
Tefoh | Sciencx Saturday October 2, 2021 » Laravel scaffold command., viewed ,<https://www.scien.cx/2021/10/02/laravel-scaffold-command/>
VANCOUVER
Tefoh | Sciencx - » Laravel scaffold command. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2021/10/02/laravel-scaffold-command/
CHICAGO
" » Laravel scaffold command." Tefoh | Sciencx - Accessed . https://www.scien.cx/2021/10/02/laravel-scaffold-command/
IEEE
" » Laravel scaffold command." Tefoh | Sciencx [Online]. Available: https://www.scien.cx/2021/10/02/laravel-scaffold-command/. [Accessed: ]
rf:citation
» Laravel scaffold command | Tefoh | Sciencx | https://www.scien.cx/2021/10/02/laravel-scaffold-command/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.