fractal->collection(Egg::all()) ->transformWith($this->getTransformer(EggTransformer::class)) ->toArray(); } /** * View egg * * Return a single egg that exists */ public function view(GetEggRequest $request, Egg $egg): array { return $this->fractal->item($egg) ->transformWith($this->getTransformer(EggTransformer::class)) ->toArray(); } }