there.我正在尝试处理Laravel框架,但存在问题。这是我的代码
public function up()
{
Schema::create('users', function($table)
{
$table->increments('id');
});
}
我进行了迁移并尝试向表中添加一些字段。但是 IDE 无法正确识别$table变量,因此我收到警告:"在类中找不到方法增量",并且我无法使用自动完成。
有没有建议如何解决这个问题?
整个代码:
<?php
使用照明''数据库''模式''蓝图;使用照明''数据库''迁移''迁移;
类 CreatePostsTable 扩展迁移 {
public function up()
{
Schema::create('posts', function($table)
{
$table->increments('id');
$table->string('title',150);
$table->text('body');
$table->string('preview',300);
$table->string('author',100);
$table->timestamps();
});
}
public function down()
{
Schema::drop('posts');
}
}
只需指定$table
的类型。该类是Illuminate'Database'Schema'Blueprint
Schema::create('users', function(Blueprint $table)
{
$table->increments('id');
});