app/Http/Controllers/DeliveryNoteItemController.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)
    {
        $input = $request->all();
		$rules = array ('dnNo' => 'required|numeric',
						'itemID' => 'required|numeric',
						'quantity' => 'required|numeric',);
		$message = ['dnNo.required' => 'Please input the delivery note number',
					'dnNo.numeric' => 'Please input the delivery note number in correct format',
					'itemID.required' => 'Please input the item id',
					'itemID.numeric' => 'Please input the item id in correct format',
					'quantity.required' => 'Please input the quantity',
					'quantity.numeric' => 'Please input the quantity in correct format',];
        $validator = Validator::make($input, $rules, $messages);                 
        if ($validator->fails()) 
		{             
            return Redirect::to('deliveryNoteItem/create')->withErrors($validator);        
        } 
		else if (!foreignKeyExists($request))
		{
			return Redirect::to('deliveryNoteItem/create')->withErrors('The composite key (agreementID, revision, itemID) is not found in DeliveryNoteItemCategory Table!');
		}
		else 
		{       
            $deliveryNoteItem = DeliveryNoteItem::where('dnNo', $request->dnNo)->where('itemID', $request->itemID);
			$deliveryNoteItem->quantity = $request->quantity;
            $deliveryNoteItem->save();         
            return back()->with('success','Successfully updated delivery note Item Information!');     
        }         
    }
public function update ( Request $ request ) { $ input = $ request -> all ( ) ; $ rules = array ( 'dnNo' => 'required|numeric' , 'itemID' => 'required|numeric' , 'quantity' => 'required|numeric' , ) ; $ message = [ 'dnNo.required' => 'Please input the delivery note number' , 'dnNo.numeric' => 'Please input the delivery note number in correct format' , 'itemID.required' => 'Please input the item id' , 'itemID.numeric' => 'Please input the item id in correct format' , 'quantity.required' => 'Please input the quantity' , 'quantity.numeric' => 'Please input the quantity in correct format' , ] ; $ validator = Validator :: make ( $ input , $ rules , $ messages ) ; if ( $ validator -> fails ( ) ) { return Redirect :: to ( 'deliveryNoteItem/create' ) -> withErrors ( $ validator ) ; } else if ( ! foreignKeyExists ( $ request ) ) { return Redirect :: to ( 'deliveryNoteItem/create' ) -> withErrors ( 'The composite key (agreementID, revision, itemID) is not found in DeliveryNoteItemCategory Table!' ) ; } else { $ deliveryNoteItem = DeliveryNoteItem :: where ( 'dnNo' , $ request -> dnNo ) -> where ( 'itemID' , $ request -> itemID ) ; $ deliveryNoteItem -> quantity = $ request -> quantity ; $ deliveryNoteItem -> save ( ) ; return back ( ) -> with ( 'success' , 'Successfully updated delivery note Item Information!' ) ; } }
Update the specified resource in storage.
Update the specified resource in storage .