Nadia
Nadia

Reputation: 73

i get this error when running migration on laravel

failed using migration in laravel. Here's my code, and I get this error:

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)

Code:

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');
    }
}

Upvotes: 1

Views: 1555

Answers (2)

Eli
Eli

Reputation: 25

This is 3 years old but maybe someday this will help someone: remove, and re-compose your "vendor" folder, the migration is stored and triggered there becuase you maybe test "Lighthouse" library for Laravel, used to implement GraphQL

Upvotes: 0

jjj
jjj

Reputation: 187

Do you have more migration files? Check them all for any missing semicolon.

Upvotes: 1

Related Questions