我是 laravel 4 的新手,在我的第一个项目中,当我尝试迁移它时,我遇到了这个错误:
Migration table created successfully. {"error":{"type":"Symfony\Component\Debug\Exception\FatalErrorException","message":"Call to undefiend method Illuminate\Database\Schema\Blueprint::increments()","file":"foo","line:19"}}
这是我在 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');
}
}
谁能帮我改正错误?
最佳答案
你打错了。
代替:
$table->incremetns('id');
应该是
$table->increments('id');
关于php - 调用未定义的方法 Illuminate\\Database\\Schema\\Blueprint::increments(),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26400802/