我正在将Laravel 5.8与PHP 7.1一起使用 它使用references()函数给出警告。
$table->foreign('student_id')->references('student_id')->on('student');
错误是:
Warning:(52, 45) Method 'references' not found in Illuminate\Support\Fluent
谢谢。
答案 0 :(得分:2)
这是您的IDE抱怨的不是Laravel问题。将此代码添加到您的_ide_helper.php
文件的顶部。
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 {}
}
此后,您的问题应该得到解决