app/Http/Controllers/PurchaseRequestItemController.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 (
						'requestID' => 'required|numeric',
						'itemID' => 'required|numeric',
						'quantity' => 'required|numeric',
						'balance' => 'required|numeric',);
		$message = [
					'requestID.required' => 'Please input the quantity',
					'itemID.required' => 'Please input the quantity',
					'requestID.numeric' => 'Please input the quantity',
					'itemID.numeric' => 'Please input the quantity',
					'quantity.required' => 'Please input the quantity',
					'quantity.numeric' => 'Please input the quantity',
					'balance.required' => 'Please input the balance in correct format',
					'balance.numeric' => 'Please input the balance',];
        $validator = Validator::make($input, $rules, $messages);                 
        if ($validator->fails()) 
		{             
            return Redirect::to('purchaseRequestItem/create')->withErrors($validator);        
        } 
		else 
		{       
            $purchaseRequestItem = PurchaseRequestItem::where('request',$request->requestID)
            											->where('itemID',$request->itemID)
            											->update(['quantity'=>$request->quantity,'balance'=>$request->balance]);          
            return back()->with('success','Successfully updated purchase request item Information!');     
        }         
    }
public function update ( Request $ request ) { $ input = $ request -> all ( ) ; $ rules = array ( 'requestID' => 'required|numeric' , 'itemID' => 'required|numeric' , 'quantity' => 'required|numeric' , 'balance' => 'required|numeric' , ) ; $ message = [ 'requestID.required' => 'Please input the quantity' , 'itemID.required' => 'Please input the quantity' , 'requestID.numeric' => 'Please input the quantity' , 'itemID.numeric' => 'Please input the quantity' , 'quantity.required' => 'Please input the quantity' , 'quantity.numeric' => 'Please input the quantity' , 'balance.required' => 'Please input the balance in correct format' , 'balance.numeric' => 'Please input the balance' , ] ; $ validator = Validator :: make ( $ input , $ rules , $ messages ) ; if ( $ validator -> fails ( ) ) { return Redirect :: to ( 'purchaseRequestItem/create' ) -> withErrors ( $ validator ) ; } else { $ purchaseRequestItem = PurchaseRequestItem :: where ( 'request' , $ request -> requestID ) -> where ( 'itemID' , $ request -> itemID ) -> update ( [ 'quantity' => $ request -> quantity , 'balance' => $ request -> balance ] ) ; return back ( ) -> with ( 'success' , 'Successfully updated purchase request item Information!' ) ; } }
Update the specified resource in storage.
Update the specified resource in storage .