我正在运行 'php artisan migrate' 我收到了这个错误:
([Illuminate\Database\QueryException] SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes (SQL: alter table users add unique users_email_unique(email))) 之后在AppServiceProvider.php
添加此代码
(使用 Illuminate\Support\Facades\Schema;和 Schema::defaultStringLength(191);)
现在我得到另一个错误
(PHP 致命错误:无法使用 Illuminate\Support\Facades
enter code here
\Schema 作为 Schema,因为该名称已在第 7 行的 C:\xampp\htdocs\projects\app\Providers\AppServiceProvider.php 中使用)
以下是 AppServiceProvider.php 代码
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use mysql_xdevapi\Schema;
use Illuminate\Support\Facades\Schema;
class AppServiceProvider extends ServiceProvider
{
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
Schema::defaultStringLength(191);
}
/**
* Register any application services.
*
* @return void
*/
public function register()`enter code here`
{
//
}
}