如果我使用Laravel的分页方法,下面的代码会给出Uncaught ErrorException: Trying to get property 'id' of non-object in...错误。如果我使用all(),它可以正常工作。resource->id, ]; }
我还尝试了创建一个ResourceCo
因此,我正在尝试利用资源来控制输出,因为我被告知这是为api输出建模数据的最佳方式。客户模型 return $this->hasMany('\App\Models\Invoice');发票模式:但是当我转到EndPoint接口时Call to a member function first() on string
Illuminate\Http\Resources\Json\ResourceCollection</em