2013-12-09 76 views
6

我來自CakePHP,最近開始學習Laravel-4。很難看出這樣一個優秀的框架沒有爲基本的CRUD操作提供代碼生成器。這是一個有意識的決定還是我錯過了什麼?Laravel代碼生成器

回答

8

很確定這是一個有意識的決定。然而,傑弗里路創造了一個殺手發生器包Laravel:

https://github.com/JeffreyWay/Laravel-4-Generators

+0

太棒了!這正是我所期待的。看起來不錯。然而,我會詢問原作者爲什麼沒有生成控制器方法體,因爲所有的信息都是已知的。可能是發電機處於早期階段,後來的版本會有這種情況。 – Scalable

+1

謝謝。你可能會問爲什麼或向Jeffrey自己請求功能。他在twitter上運行** awesome ** Laravel教程網站http://laracasts.com。他是一個非常好的人。 – TunaMaxx

+0

這是另一個殺手軟件包,它可以讓你很容易地生成所有的代碼https://github.com/CrestApps/laravel-code-generator,這裏是文檔https://crestapps.com/laravel-code-generator/文檔/ 1.0 – Jaylen

3

Laravel 5.1自帶的工匠make命令來生成不同的代碼文件,以下是名單:

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 
0

大多數數據庫中定義了我們的業務邏輯。

https://github.com/digitaldreams

通過讀取數據庫中的表生成代碼。 [它適用於Laravel 5.2及更高版本,僅適用於mysql數據庫]。