Laravel 4:执行迁移时出错

时间:2013-11-23 19:01:32

标签: php laravel-4

我有这个迁移php文件:

<?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 artisan migrate并得到了这个错误:

致命错误:Illuminate \ Filesystem \ Filesystem :: requireOnce():无法打开所需的'WWW_DIRECTORY / app / database / migrations / 2013_11_23_154547_cre ate_categories_table.php'

Aynone知道为什么会这样吗?我正在学习使用Laravel ..

1 个答案:

答案 0 :(得分:2)

你没有正确宣布你的课程。需要删除.php扩展名。而不是

class CreateCategoriesTable.php extends Migration {

使用

class CreateCategoriesTable extends Migration {