我正在尝试通过api路由将资源与集合一起使用,但是会引发错误。
ErrorException (E_NOTICE)
Undefined property: Illuminate\Database\Query\Builder::$map
以下我在路由api文件中尝试的脚本
use App\Job;
use App\Http\Resources\Jobs as JobResource;
Route::get('/jobs',function(){
return JobResource::collection(Job::all());
});
我通过命令行制作了资源和模型,请指导我为什么会出现此问题以及如何解决它。