2013-11-23 102 views
0

我有这个迁移PHP文件:Laravel 4:错误执行迁移

<?php 

use Illuminate\Database\Schema\Blueprint; 
use Illuminate\Database\Migrations\Migration; 

class CreateCategoriesTable.php extends Migration { 

    /** 
    * Run the migrations. 
    * 
    * @return void 
    */ 
    public function up() 
    { 
     Schema::create('categories', function($table) 
     { 
      $table->increments('id'); 
      $table->string('name',200); 
      $table->string('description',200); 
      $table->boolean('is_disabled'); 
      $table->timestamps(); 
     }); 
    } 

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

} 

然后我执行PHP工匠迁移和得到这个错误:

致命错误:照亮\文件系统\文件系统:: requireOnce( ):开启失败'WWW_DIRECTORY/app/database/migrations/2013_11_23_154547_cre ate_categories_table.php'

Aynone知道为什么会出现这种情况?我正在学习使用Laravel ..

回答

2

你没有正确地宣布你的班级。 .php扩展名需要删除。取而代之的

class CreateCategoriesTable.php extends Migration {

使用

class CreateCategoriesTable extends Migration {

+0

谢谢...这是我用命令行该类 – l2mt

+0

它的工作原理创建的名称的错误!并且不要忘记确保你的文件没有尾随.php! 'create_categories_table.php.php' ... – Eamorr