Method 'references' not found in Illuminate\Support\Fluent in Laravel 5.8

做~自己de王妃 提交于 2020-01-06 06:25:39

问题


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');

The error is:

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

Thanks in advance.


回答1:


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



来源:https://stackoverflow.com/questions/55223603/method-references-not-found-in-illuminate-support-fluent-in-laravel-5-8

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!