app/Http/Controllers/AgreementPriceBreakController.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',
						'priceBreak' => 'required|numeric',
						'discount' => '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',
					'priceBreak.required' => 'Please input the price break',
					'priceBreak.numeric' => 'Please input the price break in correct format',
					'discount.required' => 'Please input the discount',
					'discount.numeric' => 'Please input the discount in correct format',];
        $validator = Validator::make($input, $rules, $messages);
        if ($validator->fails()) 
		{             
            return Redirect::to('agreementPriceBreak/create')->withErrors($validator);        
        } 
		else if (foreignKeyNoExists($request))
		{
			return Redirect::to('agreementPriceBreak/create')->withErrors('The composite key (agreementID, revision, itemID) does not exist in AgreementPriceBreak Table!');
		}
		else 
		{       
            $agreementPriceBreak = AgreementPriceBreak::where('agreementID', $request->agreementID)->where('revision', $request->revision)->where('itemID', $request->itemID)->where('priceBreak', $request->priceBreak);
			$agreementPriceBreak->discount = $request->discount;
            $agreementPriceBreak->save();         
            return back()->with('success','Updated Agreement Price Break Information Successfully');
        }          
    }
public function update ( Request $ request ) { $ input = $ request -> all ( ) ; $ rules = array ( 'agreementID' => 'required|numeric' , 'revision' => 'required|numeric' , 'itemID' => 'required|numeric' , 'priceBreak' => 'required|numeric' , 'discount' => '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' , 'priceBreak.required' => 'Please input the price break' , 'priceBreak.numeric' => 'Please input the price break in correct format' , 'discount.required' => 'Please input the discount' , 'discount.numeric' => 'Please input the discount in correct format' , ] ; $ validator = Validator :: make ( $ input , $ rules , $ messages ) ; if ( $ validator -> fails ( ) ) { return Redirect :: to ( 'agreementPriceBreak/create' ) -> withErrors ( $ validator ) ; } else if ( foreignKeyNoExists ( $ request ) ) { return Redirect :: to ( 'agreementPriceBreak/create' ) -> withErrors ( 'The composite key (agreementID, revision, itemID) does not exist in AgreementPriceBreak Table!' ) ; } else { $ agreementPriceBreak = AgreementPriceBreak :: where ( 'agreementID' , $ request -> agreementID ) -> where ( 'revision' , $ request -> revision ) -> where ( 'itemID' , $ request -> itemID ) -> where ( 'priceBreak' , $ request -> priceBreak ) ; $ agreementPriceBreak -> discount = $ request -> discount ; $ agreementPriceBreak -> save ( ) ; return back ( ) -> with ( 'success' , 'Updated Agreement Price Break Information Successfully' ) ; } }
Update the specified resource in storage.
Update the specified resource in storage .