打开进入homestead虚拟机,并进入code文件夹
cd ~/homestead && vagrant up && vagrant ssh
cd ~/Code
进行composer加速
composer config -g repo.packagist composer https://packagist.laravel-china.org
创建laravel项目
composer create-project laravel/laravel *项目名* --perfer-dist "5.6.*"
修改etc/hosts 和 Homestead.yaml文件
退出虚拟机,重载配置,重启虚拟机
exit
vagrant provision && vagrant reload
vagrant ssh
生成.env文件,生成项目key
cp .env.example .env
php artisan key:generate
进入项目文件,绑定远程仓库
cd ~/code/*项目文件名*
git init
git add .
git commit -m "xxx"
git remote add origin *git项目地址*
git push -u origin master
创建Model文件夹并完善
mkdir app/Models
mv app/User.php app/Models/User.php
改User.php的namespace为App\Models
全局改App\User 为 App\Models\User
创建Controllers、requests、Transformers
mkdir app/Http/Controllers/Requests
mkdir app/Transformers
php artisan make:controller Api/xxController --model = App/Models/xx
php artisan make:request Api/UserRequest
touch app/Transformers/UserTransformer.php