首页 文章

调用未定义的方法Illuminate \\ Database \\ Schema \\ Blueprint :: incrementments()

提问于
浏览
5

我是laravel 4的新手,在我尝试迁移的第一个项目中,我遇到了这个错误:

迁移表已成功创建 . {“error”:{“type”:“Symfony \ Component \ Debug \ Exception \ FatalErrorException”,“message”:“调用undefiend方法Illuminate \ Database \ Schema \ Blueprint :: incrementments()”,“file”:“ foo”的, “行:19”}}

这是我在_1718041中的迁移代码:

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

class AddCatsAndBreedsTable extends Migration {

public function up()
{
    Schema::create('cats', function($table){
        $table->increments('id');
        $table->string('name');
        $table->date('date_of_birth')->nullable();
        $table->integer('breed_id')->nullable();
        $table->timestamps();
    });

    Schema::create('breeds', function($table){
        $table->incremetns('id');
        $table->string('name');
    });
}


public function down()
{
    Schema::drop('cats');
    Schema::drop('breeds');
}

}

任何人都可以帮我纠正错误吗?

1 回答

  • 11

    你有一个错字 .

    代替:

    $table->incremetns('id');
    

    应该

    $table->increments('id');
    

相关问题