Skip to content
Advertisement

Tag: thephpleague-fractal

Laravel / League Fractal returns an empty array instead of empty object

I’m having a problem with Fractal library. I’m using Spatielaravel-fractal library which is just wrapper for Leaguefractal. So… I want to return an empty object instead of an empty array. $this->null() always returns [] after generation and I want to return {}. Tbh I want to have 2 functions like $this->nullItem() and $this->nullCollection(). Does anyone know what’s the solution to

Advertisement