app/Http/Controllers/ItemController.php
/**
     * Update the specified resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
Update the specified resource in storage.
Update the specified resource in storage .
public function update(Request $request, $id)
    {
      $item = Item::find($id);
      $item->lender_id = $request->input('newOwner');
      $item->state_id = 2;
      $message = 'Je item is ter leen aangeboden aan ' . User::find($item->lender_id)->name;
      if ($item->save()) {
        return redirect('/items')->with('success', $message);
      }
    }
public function update ( Request $ request , $ id ) { $ item = Item :: find ( $ id ) ; $ item -> lender_id = $ request -> input ( 'newOwner' ) ; $ item -> state_id = 2 ; $ message = 'Je item is ter leen aangeboden aan ' . User :: find ( $ item -> lender_id ) -> name ; if ( $ item -> save ( ) ) { return redirect ( '/items' ) -> with ( 'success' , $ message ) ; } }
Update the specified resource in storage.
Update the specified resource in storage .