1
在laravel中使用遷移失敗。這裏是我的代碼,我得到這個錯誤:我在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');
}
}
臨時刪除此遷移,然後運行'php artisan migrate',看看是否有任何錯誤 – 2017-09-25 12:32:12