public function show($hash, Manager $fractal, BlockTransformer $blockTransformer) { $fractal->parseIncludes('transactions.inputs,transactions.outputs'); $block = Block::where('hash', $hash)->get()->first(); if (is_null($block)) { $block = is_numeric($hash) ? Block::where('height', $hash)->get()->first() : null; if (is_null($block)) { return $this->setStatusCode(404)->respond(['errors' => ['invalid-block']]); } } $block->miner_reward = $block->transactions[0]->outputs[0]->value; $item = new Item($block, $blockTransformer); $data = $fractal->setSerializer(new ArraySerializer())->createData($item)->toArray(); return $this->respond($data); }