语法错误,意外的":",预期")"终端



我正在使用Laravel和我创建迁移文件,当我在终端'php artisan migrate'中写入时,它会弹出语法错误,意外':',期望')'在$table->$table->unsignedInteger(列:'user_id');

代码:

public function up()
{
Schema::create('listings', function (Blueprint $table) {
$table->id();
$table->$table->unsignedInteger(column:'user_id');
$table->string(column:'title');
$table->string(column:'slug');
$table->string(column:'company');
$table->string(column:'location');
$table->string(column:'title');
$table->logo(column:'logo')->nullable();
$table->boolean(column:'is_highlighted')->default(value:false);
$table->boolean(column:'is_active')->default(value:true);
$table->text(column:'content');
$table->string(column:'apply_link');
$table->timestamps();
});
}

命名参数在PHP 8.0.0中可用。如果您使用的是以前版本的PHP,请不要使用它们。

$table->$table->unsignedInteger(column:'user_id');

应该

$table->unsignedInteger('user_id');

最新更新