在Laravel 5.8的Illuminate \ Support \ Fluent中找不到方法“引用" [英] Method 'references' not found in Illuminate\Support\Fluent in Laravel 5.8

查看:152
本文介绍了在Laravel 5.8的Illuminate \ Support \ Fluent中找不到方法“引用"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将Laravel 5.8与PHP 7.1一起使用 它会使用references()函数发出警告.

I am using Laravel 5.8 with PHP 7.1 It gives the warning with the references() function.

$table->foreign('student_id')->references('student_id')->on('student');

错误是:

Warning:(52, 45) Method 'references' not found in Illuminate\Support\Fluent

提前谢谢.

推荐答案

这是您的IDE抱怨的不是laravel问题.将此代码添加到_ide_helper.php文件的顶部.

It's your IDE complaining not a laravel issue. Add this code to the top of your _ide_helper.php file.

namespace Illuminate\Support{
/**
 * @method Fluent first()
 * @method Fluent after($column)
 * @method Fluent change()
 * @method Fluent nullable()
 * @method Fluent unsigned()
 * @method Fluent unique()
 * @method Fluent index()
 * @method Fluent primary()
 * @method Fluent default($value)
 * @method Fluent onUpdate($value)
 * @method Fluent onDelete($value)
 * @method Fluent references($value)
 * @method Fluent on($value)
 */
class Fluent {}
}

此后,您的问题应该得到解决

Your issue should be fixed after this

这篇关于在Laravel 5.8的Illuminate \ Support \ Fluent中找不到方法“引用"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆