2016-03-07 90 views
-1

我在line 50上得到了一个解析错误,这是我的模式创建语句的大括号,但是我看不到任何缺少的语法,所以我很困惑。解析错误{} php Migrations

代码:

class CreateUsersTable extends Migration 
{ 
    /** 
    * Run the migrations. 
    * 
    * @return void 
    */ 
    public function up() 
    { 

     Schema::create('users', function (Blueprint $table) { 

      $table->increments('user_id'); 
      $table->string('f_name'); 
      $table->string('l_name'); 
      $table->string('gender'); 
      $table->date('dob'); 
      $table->string('company_name'); 
      $table->string('email')->unique(); 
      $table->string('password'); 
      $table->increments('landline'); 
      $table->increments('mobile'); 
      $table->increments('activated'); 
      $this->increments('social_login'); 
      $table->timestamp('last_login'); 
      $table->rememberToken(); 
     } 

    } 

    /** 
    * Reverse the migrations. 
    * 
    * @return void 
    */ 
    public function down() 
    { 

     Schema::drop('users'); 
    } 
} 
+0

@ Rizier123 5.6.10 –

+1

此行$ this-> increment('social_login');应该是$ table->增量('social_login'); – Mirceac21

回答

4

Schema::create(

你永远不会关闭该(

Schema::create('users', function (Blueprint $table) { 

     $table->increments('user_id'); 
     $table->string('f_name'); 
     $table->string('l_name'); 
     $table->string('gender'); 
     $table->date('dob'); 
     $table->string('company_name'); 
     $table->string('email')->unique(); 
     $table->string('password'); 
     $table->increments('landline'); 
     $table->increments('mobile'); 
     $table->increments('activated'); 
     $this->increments('social_login'); 
     $table->timestamp('last_login'); 
     $table->rememberToken(); 
    }); 
0

您正确使用increments方法 - Laravel将试图使每个$table->increments(...);报表的自动递增的主键。即使指定的字段不会建议自动递增字段将是适当的,您应该检查出可用的方法in the Laravel docs