public function getDispatched($purchaseId)
    {
        $purchase = Purchase::findOrFail($purchaseId);

        if ($purchase->item->seller->userId != Auth::user()->userId) {
            return redirect('/inventory/sold')->withErrors([
                "You are not seller of this item."
            ]);
        }

        if ($purchase->isDispatched()) {
            return redirect('/inventory/sold')->withStatus(
                'You have already marked this item as dispatched.'
            );
        }

        if (!$purchase->deliveryOption) {
            return redirect()->back()->withErrors([
                "This item is due to be collected."
            ]);
        }

        return view('mustard::purchase.dispatched', [
            'purchase' => $purchase,
        ]);
    }
public function getDispatched($purchaseId)
    {
        $purchase = Purchase::findOrFail($purchaseId);

        if ($purchase->item->seller->userId != Auth::user()->userId) {
            return redirect('/inventory/sold')->withErrors([
                "You are not seller of this item."
            ]);
        }

        if ($purchase->isDispatched()) {
            return redirect('/inventory/sold')->withStatus(
                'You have already marked this item as dispatched.'
            );
        }

        if (!$purchase->deliveryOption) {
            return redirect()->back()->withErrors([
                "This item is due to be collected."
            ]);
        }

        return view('mustard::purchase.dispatched', [
            'purchase' => $purchase,
        ]);
    }
public function getDispatched ( $ purchaseId ) { $ purchase = Purchase :: findOrFail ( $ purchaseId ) ; if ( $ purchase -> item -> seller -> userId != Auth :: user ( ) -> userId ) { return redirect ( '/inventory/sold' ) -> withErrors ( [ "You are not seller of this item." ] ) ; } if ( $ purchase -> isDispatched ( ) ) { return redirect ( '/inventory/sold' ) -> withStatus ( 'You have already marked this item as dispatched.' ) ; } if ( ! $ purchase -> deliveryOption ) { return redirect ( ) -> back ( ) -> withErrors ( [ "This item is due to be collected." ] ) ; } return view ( 'mustard::purchase.dispatched' , [ 'purchase' => $ purchase , ] ) ; }
Return the purchase dispatched view.

@return \Illuminate\View\View
Return the purchase dispatched view .