【问题标题】:Illuminate\Support\Fluent Methods in Migration not found未找到迁移中的 Illuminate\Support\Fluent 方法
【发布时间】:2019-03-14 16:08:47
【问题描述】:

我正在将 PhpStorm 与 Laravel 和 ide-helper 插件一起使用。

我已将 api-helper.php 中的 include_fluent 更改为 true 并运行 php artisan ide-helper:generate。但我还是得到了

“在 Illuminate\Support\Fluent 中找不到方法‘引用’”

这一行有错误:

$table->foreign('author')->references('id')->on('users');

【问题讨论】:

    标签: php laravel phpstorm laravel-migrations


    【解决方案1】:

    很难说可能出了什么问题,但请确保 up 方法中的代码如下所示:

    Schema::table('your_table', function (\Illuminate\Database\Schema\Blueprint $table) {
        $table->foreign('author')->references('id')->on('users');
    });
    

    (当然用你的真实表替换table)。它应该可以正常工作。

    【讨论】:

      猜你喜欢
      • 2021-01-08
      • 1970-01-01
      • 1970-01-01
      • 2015-06-15
      • 2019-06-05
      • 2019-01-28
      • 2019-12-30
      • 2017-03-08
      相关资源
      最近更新 更多