I come from CakePHP, recently started learning Laravel-4. It is very hard to see that such a great framework does not come with a code generator for basic CRUD operations. Is that a conscious decision or am I missing something ?
7 Answers
Pretty certain it was a conscious decision. However, Jeffrey Way has created a killer Generator package for Laravel:
-
Great!! that is exactly what I was looking for. Looks good. I would however aks the original author why it did not generated the controller method body, as all the information is already known. May be the Generator is in its early stages and later version will have that.– ScalableDec 9, 2013 at 17:48
-
1Thanks. You could probably ask why or request features to Jeffrey himself. He's on twitter and runs the awesome Laravel tutorial site laracasts.com. He's a really nice guy.– TunaMaxxDec 9, 2013 at 17:57
-
Here is another killer package that allows you to generate all that code very easily github.com/CrestApps/laravel-code-generator and here is the doc crestapps.com/laravel-code-generator/docs/1.0– JaylenDec 31, 2016 at 19:42
Laravel 5.1 comes with artisan make command to generate different code files, following is a list:
Available commands for the "make" namespace:
make:command Create a new command class
make:console Create a new Artisan command
make:controller Create a new resource controller class
make:event Create a new event class
make:job Create a new job class
make:listener Create a new event listener class
make:middleware Create a new middleware class
make:migration Create a new migration file
make:model Create a new Eloquent model class
make:policy Create a new policy class
make:provider Create a new service provider class
make:request Create a new form request class
make:seeder Create a new seeder class
make:test Create a new test class
This is a great package. Very flixable and generate complete and clean code.
https://packagist.org/packages/crestapps/laravel-code-generator
It has full documentation at http://crestapps.com/laravel-code-generator/docs/2.2
Here are YouTube screencasts to get you started https://www.youtube.com/channel/UCkEd0nOoRf3o0ahspAu7Y9w/videos
Here is one another package that I have created and which generates a API/CRUD via one single command.
You can try using the Vemto to generate all your APIs/CRUDs.
It is a very flexible generator that generates clean and easy-to-read codes.
I also did a code generator that will read database table structure and create Laravel Models, Request, Controller and other assets according to that.