Level 51
try add brackets
$table->integer('user_id')->unsigned()->index();
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
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
try add brackets
$table->integer('user_id')->unsigned()->index();
Please or to participate in this conversation.