2017-01-20 166 views
1

當我的繼承人遷移代碼:

class CreateOrdersTable extends Migration 
 
{ 
 
    /** 
 
    * Run the migrations. 
 
    * 
 
    * @return void 
 
    */ 
 
    public function up() 
 
    { 
 
      Schema::create('orders', function (Blueprint $table){ 
 
      $table->increments('order_id'); 
 
      $table->integer('order_no'); 
 
      $table->string('total_price'); 
 
      $table->date('date_received'); 
 
      $table->date('date_expected'); 
 
      $table->integer('product_id')->unsigned(); 
 
      $table->foreign('product_id')->references('product_id')->on('product'); 
 
      $table->string('product_snumber'); 
 
      $table->integer('customer_name') 
 
      $table->string('order_status'); 
 
      $table->timestamps(); 
 
      }); 
 
    } 
 

 
    /** 
 
    * Reverse the migrations. 
 
    * 
 
    * @return void 
 
    */ 
 
    public function down() 
 
    { 
 
       Schema::dropIfExists('orders'); 
 
    } 
 
}

但是在我運行的PHP工匠遷移「,在出現以下錯誤。

[Symfony的\分量\調試\異常\ FatalThrowableError]
解析錯誤:語法錯誤,意外 '$表'(T_VARIABLE)

請幫幫忙!我正在遷移到phpmyadmin數據庫。

+3

你有交叉檢查你的遷移嗎?那些**意外的'$ table'**可能與缺少';'或其他內容有關,只是證明 - 讀取語法.. –

+0

@BagusTesa是的,我已經跨越了我的遷移。顯然,錯誤行似乎是'$ table-> string('order_status');'。任何想法爲什麼? –

+0

對不起,我解決了它。它是一個失蹤的';'畢竟... –

回答

0

是@Bagus Tesa是對的。 (只是想回答,因爲我幾乎錯過了評論,因爲它不包含答案) 缺少分號;可能是問題。檢查所有修改後的遷移。

相關問題