Php – Call to undefined method Illuminate\\Database\\Schema\\Blueprint::increments()

laravellaravel-4migrationMySQLPHP

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?

Best Answer

You have a typo.

Instead of:

$table->incremetns('id');

should be

$table->increments('id');
Related Topic