2015-11-01 128 views
1

我使用Laravel 5.1.11工作,但是當我嘗試運行php artisan migrate命令我面臨着以下錯誤消息:Laravel 5.1.11遷移使用PHP工匠不爲我

****[symfony\Component\Debug\Exception\FatalErrorException] syntax Error, unexpected 'public' (T_PUBLIC)**** 

隨着數據庫連接配置database.php.env是相當好的,因爲php artisan migrate:install工作得很好。

這是遷移代碼:

**<?php 
     use Illuminate\Database\Schema\Blueprint; 
     use Illuminate\Database\Migrations\Migration; 
     class CreateFlightsTables extends Migration 
     { 
      /** 
      * Run the migrations. 
      * 
       // 
       Schema::create('flights', function (Blueprint $table) { 

      * @return void 
      */ 
      public function up() 
     { 
      // 
      Schema::create('flights', function (Blueprint $table) { 
       $table->increments('id'); 
       $table->string('name'); 
       $table->string('airline'); 
       $table->timestamps(); 
     } 
      /** 
      * Reverse the migrations. 
      * 
      * @return void 
      */ 
      public function down() 
      { 
       // 
       Schema::drop('flights'); 
      } 
     }** 
+0

你可以張貼一些源在您的遷移中使用的遷移和代碼?該錯誤看起來像是其中一個文件存在語法錯誤,並且可能不是遷移。 –

+0

將您的遷移代碼粘貼到此處,以便我們可以找到錯誤。 – fico7489

+0

請注意以下遷移文件: – wafutech

回答

2

試試你function up()

Schema::create('flights', function (Blueprint $table) { 
    $table->increments('id'); 
    $table->string('name'); 
    $table->string('airline'); 
    $table->timestamps(); 
}); 

認爲你是在年底失蹤支架和分號替換