Example #1
0
 /**
  * GET /api/items/{items}
  * @param Item $item
  * @return Response
  */
 public function show(Item $item)
 {
     $breadcrumb = $item->breadcrumb();
     $array = [];
     foreach (collect($breadcrumb) as $item) {
         $array[] = $item;
     }
     $children = $item->children()->order('priority')->get();
     $children = $this->transform($this->createCollection($children, new ItemTransformer()))['data'];
     $array = $this->transform($this->createCollection($array, new ItemTransformer()))['data'];
     $item = $this->transform($this->createItem($item, new ItemTransformer()))['data'];
     $item['children'] = $children;
     $item['breadcrumb'] = $array;
     return response($item, Response::HTTP_OK);
 }