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)
    {
        $name     = (Input::has('name')) ? Input::get('name') : NULL;
        $price    = (Input::has('price')) ? Input::get('price') : 0.0;
        $paramObj = $this->repo->getObjByID($id);
        $paramObj->name   = $name;
        $paramObj->price  = $price;
        $result = $this->repo->update($paramObj);
        return redirect()->action('ItemController@index')->with('status', $result['statusMessage']);
    }
public function update ( Request $ request , $ id ) { $ name = ( Input :: has ( 'name' ) ) ? Input :: get ( 'name' ) : NULL ; $ price = ( Input :: has ( 'price' ) ) ? Input :: get ( 'price' ) : 0.0 ; $ paramObj = $ this -> repo -> getObjByID ( $ id ) ; $ paramObj -> name = $ name ; $ paramObj -> price = $ price ; $ result = $ this -> repo -> update ( $ paramObj ) ; return redirect ( ) -> action ( 'ItemController@index' ) -> with ( 'status' , $ result [ 'statusMessage' ] ) ; }
Update the specified resource in storage.
Update the specified resource in storage .
/* update the specified object */ //get validated input // get object by ID // save the object using repository