1.打开进入homestead虚拟机,并进入code文件夹

cd ~/homestead && vagrant up && vagrant ssh

cd ~/Code

2.进行composer加速

composer config -g repo.packagist composer https://packagist.laravel-china.org

3.创建laravel项目

composer create-project laravel/laravel *项目名* --perfer-dist "5.6.*"

4.修改etc/hosts 和 Homestead.yaml文件

5.退出虚拟机,重载配置,重启虚拟机

exit

vagrant provision && vagrant reload

vagrant ssh

6.生成.env文件,生成项目key

cp .env.example .env

php artisan key:generate

7.进入项目文件,绑定远程仓库

cd ~/code/*项目文件名*

git init -> git add . -> git commit -m "xxx" -> git remote add origin *git项目地址* -> git push -u origin master

8.创建Model文件夹并完善

mkdir app/Models

mv app/User.php app/Models/User.php

改User.php的namespace为App\Models
全局改App\User 为 App\Models\User

9.创建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

版权声明:本文为shine-c原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://www.cnblogs.com/shine-c/p/10148157.html