public function getIndex($itemId)
    {
        $item = Item::findOrFail($itemId);

        if (!$item->isStarted() && $item->seller->userId != Auth::user()->userId) {
            return mustard_redirect('/');
        }

        if (mustard_loaded('media')) {
            $photos = $item->photos()->orderBy('primary', 'desc')->get();

            if ($photos->isEmpty()) {
                $photos->push(new Photo());
            };
        }

        $bids = mustard_loaded('auctions')
            ? $item->getBidHistory()
            : new Collection();

        $highest_bid = mustard_loaded('auctions')
            ? ($bids->first() ?: new \Hamjoint\Mustard\Auctions\Bid())
            : new Collection();

        return view('mustard::item.summary', [
            'item'        => $item,
            'photos'      => $photos,
            'bids'        => $bids,
            'highest_bid' => $highest_bid,
        ]);
    }
public function getIndex($itemId)
    {
        $item = Item::findOrFail($itemId);

        if (!$item->isStarted() && $item->seller->userId != Auth::user()->userId) {
            return mustard_redirect('/');
        }

        if (mustard_loaded('media')) {
            $photos = $item->photos()->orderBy('primary', 'desc')->get();

            if ($photos->isEmpty()) {
                $photos->push(new Photo());
            };
        }

        $bids = mustard_loaded('auctions')
            ? $item->getBidHistory()
            : new Collection();

        $highest_bid = mustard_loaded('auctions')
            ? ($bids->first() ?: new \Hamjoint\Mustard\Auctions\Bid())
            : new Collection();

        return view('mustard::item.summary', [
            'item'        => $item,
            'photos'      => $photos,
            'bids'        => $bids,
            'highest_bid' => $highest_bid,
        ]);
    }
public function getIndex ( $ itemId ) { $ item = Item :: findOrFail ( $ itemId ) ; if ( ! $ item -> isStarted ( ) && $ item -> seller -> userId != Auth :: user ( ) -> userId ) { return mustard_redirect ( '/' ) ; } if ( mustard_loaded ( 'media' ) ) { $ photos = $ item -> photos ( ) -> orderBy ( 'primary' , 'desc' ) -> get ( ) ; if ( $ photos -> isEmpty ( ) ) { $ photos -> push ( new Photo ( ) ) ; } ; } $ bids = mustard_loaded ( 'auctions' ) ? $ item -> getBidHistory ( ) : new Collection ( ) ; $ highest_bid = mustard_loaded ( 'auctions' ) ? ( $ bids -> first ( ) ? : new \ Hamjoint \ Mustard \ Auctions \ Bid ( ) ) : new Collection ( ) ; return view ( 'mustard::item.summary' , [ 'item' => $ item , 'photos' => $ photos , 'bids' => $ bids , 'highest_bid' => $ highest_bid , ] ) ; }
Return the item summary view.

@param int $itemId

@return \Illuminate\View\View
Return the item summary view .