vendredi 5 mai 2017

Php artisan migrate - unexpected 'string' (T_STRING)

When I run php artisan migrate to make the tables for my databases in Laravel I get the following error:

 [Symfony\Component\Debug\Exception\FatalThrowableError]
 Parse error: syntax error, unexpected 'string' (T_STRING), expecting variable (T_VARIABLE)

I think that this error is quite useless since it doesn't tell me in what file, and what place something is wrong (and that makes it very hard to understand what's going on).

The migration seems to fail with the first migration since it didn't generate a single table in my database.

This is the migration (User -> generated with php artisan make:auth):

<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateUsersTable extends Migration
{
    public function up()
    {
        Schema::create('users', function (Blueprint $table) {
            $table->increments('id');
            $table->string('name');
            $table->string('email')->unique();
            $table->string('password');
            $table->avatar('avatar');
            $table->rememberToken();
            $table->timestamps();
        });
    }

    public function down()
    {
        Schema::dropIfExists('users');
    }
}

It is just the default migration with one new line. I can't find out what's wrong with it. I already tried composer dump-autoload and composer clearcache but nothing works.

I hope somebody knows a solution.

EDIT: it appears to happen before the first migration runs. Is there a file where something might be wrong?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire