DEV Community

Tefoh
Tefoh

Posted on

6 2

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

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

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
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

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 :)

Image of AssemblyAI

Automatic Speech Recognition with AssemblyAI

Experience near-human accuracy, low-latency performance, and advanced Speech AI capabilities with AssemblyAI's Speech-to-Text API. Sign up today and get $50 in API credit. No credit card required.

Try the API

Top comments (1)

Collapse
 
luiz_ferreira_e1dcd820abc profile image
Luiz Ferreira

I am update for laravel version 10
github.com/luiz0067yahoo/laravel-s...

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Discover a treasure trove of wisdom within this insightful piece, highly respected in the nurturing DEV Community enviroment. Developers, whether novice or expert, are encouraged to participate and add to our shared knowledge basin.

A simple "thank you" can illuminate someone's day. Express your appreciation in the comments section!

On DEV, sharing ideas smoothens our journey and strengthens our community ties. Learn something useful? Offering a quick thanks to the author is deeply appreciated.

Okay