2016-03-07 86 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