【发布时间】:2017-06-04 22:48:34
【问题描述】:
这是我的迁移代码:
class CreateOrdersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('orders', function (Blueprint $table){
$table->increments('order_id');
$table->integer('order_no');
$table->string('total_price');
$table->date('date_received');
$table->date('date_expected');
$table->integer('product_id')->unsigned();
$table->foreign('product_id')->references('product_id')->on('product');
$table->string('product_snumber');
$table->integer('customer_name')
$table->string('order_status');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('orders');
}
}
但是我运行 'php artisan migrate' 后,出现以下错误。
[Symfony\Component\Debug\Exception\FatalThrowableError]
解析错误:语法错误,意外的 '$table' (T_VARIABLE)
请帮忙!我正在迁移到 phpmyadmin 数据库。
【问题讨论】:
-
您是否对迁移进行了交叉检查?那些 unexpected '$table' 可能与缺少
;或其他原因有关,只需校对语法.. -
@BagusTesa 是的,我已经交叉检查了我的迁移。显然错误行似乎是'$table->string('order_status');'。知道为什么吗?
-
对不起,我已经解决了。毕竟它缺少
;... -
没关系,有时我也错过了一些
;
标签: laravel-5.3 database-migration