我决定测试新的 Laravel。所以我从基本命令开始:
$ laravel new blog
$ php artisan make:auth
$ php artisan migrate
我编辑了 AppServiceProvider.php 文件并向启动方法添加了默认字符串长度
use Illuminate\Support\Facades\Schema;
function boot()
{
Schema::defaultStringLength(191);
}
但是我仍然有一个错误:
[Symfony\Component\Debug\Exception\FatalErrorException]
Call to undefined method Illuminate\Database\Schema\MySqlBuilder::defaultStringLength()
最佳答案
在应用程序/提供商中 打开AppServiceProviders
在启动函数中
Schema::defaultStringLength(191);
并在顶部添加以下类
use Illuminate\Support\Facades\Schema;
虽然在laravel 5.6中不需要使用
关于php - Laravel 在 php artisan make :auth 之后进行 php artisan 迁移失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43956210/