Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

codemode's avatar

Php artisan migrate returns error

Hello, I just started a fresh Laravel project. This is what a new migration file looks like --

public function up()
    {
        Schema::create('imcs', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('user_id')->unsigned->index();
            $table->decimal('peso');
            $table->decimal('altura');
            $table->decimal('imccalculado');
            $table->string('clasificacion');
            $table->timestamps();
        });
    }

However, on running php artisan migrate , i get --

 [Symfony\Component\Debug\Exception\FatalThrowableError]  
  Call to a member function index() on boolean             
                                                 

Where am i going wrong? Thanks

0 likes
2 replies
tomopongrac's avatar
Level 51

try add brackets

$table->integer('user_id')->unsigned()->index();
codemode's avatar

@tomi ... just figured it out as you were typing the reply. Silly me.. hehe.

Please or to participate in this conversation.