[Laravel 學習筆記] 開發工作流 Best Practice Workflow
最近因為 Web Programming 教學的關係,比較常碰 PHP ,這邊記錄自己嘗試的開發工作流,還有很多需要學習,歡迎大家分享自己的經驗:)Require : Homestead have setup ,安裝參考[Laravel 學習筆記] 安裝 Laravel 教學,而開發環境設定參考[Laravel 學習筆記] 使用 Laravel Homestead 設置開發環境
1. 開啟新專案(另外可以搭配 Backbone / Angular / React 等前端 Framework)
composer create-project laravel/laravel project-name --prefer-dist
2. Add model generator
"require-dev": {
"way/generators": "~2.0"
}
composer update --dev
'Way\Generators\GeneratorsServiceProvider'
php artisan
JeffreyWay/Laravel-4-Generators3. php artisan migrate:make create_table_name --tablenames --create
4. setting the Schema Builder
5. php artisan migrate
6. setup the Eloquent mapping / Model
7. Setup the View Blade Structure
- app
-- views
--- layouts
------- default.blade.php
------- sidebar.blade.php
--- pages
------- home.blade.php
------- about.blade.php
------- projects.blade.php
------- contact.blade.php
--- includes
------- head.blade.php
------- header.blade.php
------- footer.blade.php
------- sidebar.blade.php
via (Simple Laravel Layouts using Blade)8. Add public/scripts, public/styles, public/images
9. Setup the Routes & Controller
10. add from validation / filter / Auth
參考文件:
1. JeffreyWay/Laravel-4-Generators
2. Simple Laravel Layouts using Blade
3. Deal with Laravel assets by Bower & Gulp
4. laracasts/Laravel-5-Generators-Extended
composer require 'laracasts/generators' --dev