I'm new at laravel 4 and in my first project when I try to migrate this I got this error :
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"}}
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?
You have a typo.
Instead of:
$table->incremetns('id');
should be
$table->increments('id');
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With