我正在使用Laravel 5.1.11,但是当我尝试运行php artisan migrate
命令时,遇到以下错误消息:
****[symfony\Component\Debug\Exception\FatalErrorException] syntax Error, unexpected 'public' (T_PUBLIC)****
在进行数据库连接配置的情况下database.php
,.env
还可以,因为php artisan migrate:install
效果很好。
这是迁移代码:
**<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateFlightsTables extends Migration
{
/**
* Run the migrations.
*
//
Schema::create('flights', function (Blueprint $table) {
* @return void
*/
public function up()
{
//
Schema::create('flights', function (Blueprint $table) {
$table->increments('id');
$table->string('name');
$table->string('airline');
$table->timestamps();
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
Schema::drop('flights');
}
}**
尝试更换您的function up()
用
Schema::create('flights', function (Blueprint $table) {
$table->increments('id');
$table->string('name');
$table->string('airline');
$table->timestamps();
});
认为您最后缺少括号和分号
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句