在laravel中使用迁移失败。这是我的代码,我收到了这个错误:
PHP Parse error: syntax error, unexpected '$table' (T_VARIABLE),
expecting identifier (T_STRING) in C:\xampp\htdocs\multi-providers\database\migrations\2017_09_25_114701_create_social_provider_table.php
on line 18
[Symfony\Component\Debug\Exception\FatalErrorException] syntax
error, unexpected '$table' (T_VARIABLE), expecting identifier(T_STRING)
代码:
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateSocialProviderTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('social_provider', function (Blueprint $table) {
$table->increments('id');
$table->integer('user_id')->unsigned();
$table->foreign('user_id')->references('user_id')->on('users');
$table->string('provider_id');
$table->string('provider');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('social_provider');
}
}
答案 0 :(得分:0)
您有更多迁移文件吗?检查所有丢失的分号。
答案 1 :(得分:0)
这是 3 岁,但也许有一天这会帮助某人:删除并重新组合您的“供应商”文件夹,迁移存储并在那里触发,因为您可能会测试 Laravel 的“灯塔”库,用于实现 GraphQL