牛骨文教育服务平台(让学习变的简单)
博文笔记

FatalThrowableError in index.php line 554:Type error: Argument 1 passed

创建时间:2017-11-03 投稿人: 浏览次数:880

错误描述:

FatalThrowableError in index.php line 554:Type error: Argument 1 passed to IlluminateDatabaseEloquentRelationsindex::save() must be an instance of IlluminateDatabaseEloquentModel, instance of stdClass given, called in D:xampphtdocspublic_laravel_5.1public_laravel_5.1appRole.php on line 18

错误分析:

造成这个的原因是由于方法中有类型限制,传入参数的时候参数的类型不对,对比以后发现是有一个类没有实例化 即没有new 这个类导致报此错误

解决方法:

new yourClass(); 或者检查你的方法中传入的参数是不是正确的

声明:该文观点仅代表作者本人,牛骨文系教育信息发布平台,牛骨文仅提供信息存储空间服务。