本文介绍了调用未定义的方法Illuminate \\ Database \\ Schema \\ Blueprint :: increments()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我是laravel 4的新手,在我的第一个项目中,尝试迁移此错误时,我遇到了这个错误:
I'm new at laravel 4 and in my first project when I try to migrate this I got this error :
这是我在app\migration\2014_10_14_114343_add_cats_and_breeds_table.php
中的迁移代码:
And this my migration code in app\migration\2014_10_14_114343_add_cats_and_breeds_table.php
:
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');
}
}
任何人都可以帮助我纠正错误吗?
Can any one help me correct the error?
推荐答案
您有错字.
代替:
$table->incremetns('id');
应该是
$table->increments('id');
这篇关于调用未定义的方法Illuminate \\ Database \\ Schema \\ Blueprint :: increments()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!