Owl\Http\Controllers\ItemController::show PHP Method

show() public method

public show ( $openItemId )
    public function show($openItemId)
    {
        $item = $this->itemService->getByOpenItemIdWithComment($openItemId);
        if (empty($item)) {
            \App::abort(404);
        }
        $item_tags = $this->itemService->getTagsToArray($item);
        $user = $this->userService->getCurrentUser();
        if ($item->published === "0") {
            if (empty($user)) {
                \App::abort(404);
            } elseif ($item->user_id !== $user->id) {
                \App::abort(404);
            }
        }
        $stock = null;
        $like = null;
        if (!empty($user)) {
            $stock = $this->stockService->getByUserIdAndItemId($user->id, $item->id);
            $like = $this->likeService->get($user->id, $item->id);
        }
        $stocks = $this->stockService->getByItemId($item->id);
        $recent_stocks = $this->stockService->getRecentRankingWithCache(5, 7);
        $user_items = $this->itemService->getRecentsByUserId($item->user_id);
        $like_users = $this->itemService->getLikeUsersById($item->id);
        return \View::make('items.show', compact('item', 'item_tags', 'user_items', 'stock', 'like', 'like_users', 'stocks', 'recent_stocks'));
    }