/** * Turn this item object into a generic array * * @return array */ public function transform(Menu $menu) { return ['id' => $menu->id, 'date' => $this->formatDate($menu->getDate()), 'type' => $menu->getType(), 'products' => $this->processCollection($menu->menuProducts()->get(), new MenuProductsTransformer())]; }