Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 232
ᴀʀᴍᴀɴ Avatar asked Oct 16 '14 09:10

ᴀʀᴍᴀɴ


1 Answers

You have a typo.

Instead of:

$table->incremetns('id');

should be

$table->increments('id');
like image 148
Marcin Nabiałek Avatar answered Sep 24 '22 20:09

Marcin Nabiałek