wafutech
wafutech

Reputation: 551

Laravel 5.1.11 migrate with php artisan does not work for me

I am using Laravel 5.1.11 but when I try to run php artisan migrate command I am faced with the following error message:

 ****[symfony\Component\Debug\Exception\FatalErrorException] syntax Error, unexpected 'public' (T_PUBLIC)****

With database connection configuration in database.php and .env is quite fine because php artisan migrate:install works just fine.

this is the migration code:

   **<?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');
            }
        }**

Upvotes: 1

Views: 5541

Answers (1)

Saad
Saad

Reputation: 1221

Try replacing your function up() with

Schema::create('flights', function (Blueprint $table) {
    $table->increments('id');
    $table->string('name');
    $table->string('airline');
    $table->timestamps();
});

Think you are missing bracket and semicolon at the end

Upvotes: 2

Related Questions