public function postEdit(Request $request)
    {
        $item = Item::findOrFail($request->input('item_id'));

        if ($item->userId != Auth::user()->userId) {
            return redirect()->back()->withErrors(['You can only edit your own items.']);
        }

        if (!$item->isActive()) {
            return redirect()->back()->withErrors(['You can only edit an active item.']);
        }

        return redirect('/inventory/selling')
            ->withStatus($item->name.' has been edited.');
    }
public function postEdit(Request $request)
    {
        $item = Item::findOrFail($request->input('item_id'));

        if ($item->userId != Auth::user()->userId) {
            return redirect()->back()->withErrors(['You can only edit your own items.']);
        }

        if (!$item->isActive()) {
            return redirect()->back()->withErrors(['You can only edit an active item.']);
        }

        return redirect('/inventory/selling')
            ->withStatus($item->name.' has been edited.');
    }
public function postEdit ( Request $ request ) { $ item = Item :: findOrFail ( $ request -> input ( 'item_id' ) ) ; if ( $ item -> userId != Auth :: user ( ) -> userId ) { return redirect ( ) -> back ( ) -> withErrors ( [ 'You can only edit your own items.' ] ) ; } if ( ! $ item -> isActive ( ) ) { return redirect ( ) -> back ( ) -> withErrors ( [ 'You can only edit an active item.' ] ) ; } return redirect ( '/inventory/selling' ) -> withStatus ( $ item -> name . ' has been edited.' ) ; }
Edit an item.

@param \Illuminate\Http\Request $request

@return \Illuminate\Http\RedirectResponse
Edit an item .