【问题标题】:I have an error migrating my tables in laravel 5.3我在 laravel 5.3 中迁移表时出错
【发布时间】:2017-01-29 14:14:11
【问题描述】:

我是新来的,有一个我无法解决的问题。

我正在使用以下命令创建迁移:php artisan make:migration table --create=table

但是当我进入“php artisan migrate”时,我有这个错误

[Symfony\Component\Debug\Exception\FatalErrorException] 解析错误

所有的表格都是这样的:

<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CTEquiposMantenciones extends Migration
{
    public function up()
    {
        Schema::create('equipos_mantenciones', function (Blueprint $table) {
            $table->increments('id')->unique();
            $table->integer('equipos_id');
            $table->integer('matenciones_id');
        });
    }   
    public function down()
    {
        Schema::dropIfExists('equipos_mantenciones');
    }
}

【问题讨论】:

    标签: php laravel migration


    【解决方案1】:

    这意味着其中一个迁移文件存在语法错误。缺少分号、不正确的右括号、拼写错误等...

    运行后,你可能会遇到这种错误:

    $ php artisan migrate
    PHP Parse error:  syntax error, unexpected ''name'' (T_CONSTANT_ENCAPSED_STRING) in /home/hradecek/laravel/2014_10_12_000000_create_users_table.php on line 18
    PHP Stack trace:
    ...
    

    这可能会提示您出了什么问题,尤其是带有文件路径和行号的部分。

    在这个具体示例中,路径 /home/hradecek/laravel/2014_10_12_000000_create_users_table.php 上的文件中的 第 18 行 有问题。

    【讨论】:

    • 谢谢,是这个问题,我没看到
    • 很高兴听到这个消息,您能否将答案标记为解决方案:)
    猜你喜欢
    • 1970-01-01
    • 2018-01-20
    • 2017-07-20
    • 2018-05-03
    • 2017-06-21
    • 2017-02-26
    • 1970-01-01
    • 2017-05-07
    • 2020-06-22
    相关资源
    最近更新 更多