app/Http/Controllers/AgreementLineController.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 ('agreementID' => 'required|numeric',
						'revision' => 'required|numeric',
						'itemID' => 'required|numeric',
						'agreementLineID' => 'required|numeric',
						'price' => 'required|numeric',);
		$message = ['agreementID.required' => 'Please input the agreement id',
					'agreementID.numeric' => 'Please input the agreement id in correct format',
					'revision.required' => 'Please input the revision',
					'revision.numeric' => 'Please input the revision in correct format',
					'itemID.required' => 'Please input the item id',
					'itemID.numeric' => 'Please input the item id in correct format',
					'price.required' => 'Please input the price',
					'price.numeric' => 'Please input the price in correct format',];
        $validator = Validator::make($input, $rules, $messages);                 
        if ($validator->fails())
		{             
            return Redirect::to('agreementLine/create')->withErrors($validator);        
        } 
		else if (validateInput($request->categoryID))
		{
			return Redirect::to('agreementLine/create')->withErrors('The agreement id does not exist in AgreementLine Table!');
		}
		else 
		{       
            $agreementLine = AgreementLine::where('agreementID', $request->agreementID)->where('revision', $request->revision)->where('itemID', $request->itemID);          
			$agreementLine->promisedQuantity = $request->promisedQuantity;
			$agreementLine->balance = $request->balance;
			$agreementLine->minimumOrderQuantity = $request->minimumOrderQuantity;
			$agreementLine->price = $request->price;
			$agreementLine->reference = $request->reference;
            $agreementLine->save();
            return back()->with('success','Updated Agreement Line Information Successfully');
        }         
    }
public function update ( Request $ request ) { $ input = $ request -> all ( ) ; $ rules = array ( 'agreementID' => 'required|numeric' , 'revision' => 'required|numeric' , 'itemID' => 'required|numeric' , 'agreementLineID' => 'required|numeric' , 'price' => 'required|numeric' , ) ; $ message = [ 'agreementID.required' => 'Please input the agreement id' , 'agreementID.numeric' => 'Please input the agreement id in correct format' , 'revision.required' => 'Please input the revision' , 'revision.numeric' => 'Please input the revision in correct format' , 'itemID.required' => 'Please input the item id' , 'itemID.numeric' => 'Please input the item id in correct format' , 'price.required' => 'Please input the price' , 'price.numeric' => 'Please input the price in correct format' , ] ; $ validator = Validator :: make ( $ input , $ rules , $ messages ) ; if ( $ validator -> fails ( ) ) { return Redirect :: to ( 'agreementLine/create' ) -> withErrors ( $ validator ) ; } else if ( validateInput ( $ request -> categoryID ) ) { return Redirect :: to ( 'agreementLine/create' ) -> withErrors ( 'The agreement id does not exist in AgreementLine Table!' ) ; } else { $ agreementLine = AgreementLine :: where ( 'agreementID' , $ request -> agreementID ) -> where ( 'revision' , $ request -> revision ) -> where ( 'itemID' , $ request -> itemID ) ; $ agreementLine -> promisedQuantity = $ request -> promisedQuantity ; $ agreementLine -> balance = $ request -> balance ; $ agreementLine -> minimumOrderQuantity = $ request -> minimumOrderQuantity ; $ agreementLine -> price = $ request -> price ; $ agreementLine -> reference = $ request -> reference ; $ agreementLine -> save ( ) ; return back ( ) -> with ( 'success' , 'Updated Agreement Line Information Successfully' ) ; } }
Update the specified resource in storage.
Update the specified resource in storage .