app/Http/Controllers/DeliveryNoteController.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',
						'diNo' => 'required|numeric',
						'createdDate' => 'required',
						'status' => 'required',);
		$message = ['dnNo.required' => 'Please input the delivery note number',
					'dnNo.numeric' => 'Please input the delivery note number in correct format',
					'diNo.required' => 'Please input the dispatch Instruction number',
					'diNo.numeric' => 'Please input the dispatch Instruction number in correct format',
					'createdDate.required' => 'Please input the created date',
					'status.required' => 'Please input the status',];
        $validator = Validator::make($input, $rules, $messages);                 
        if ($validator->fails()) 
		{             
            return Redirect::to('deliveryNote/create')->withErrors($validator);        
        } 
		else if (!foreignKeyExists($request))
		{
			return Redirect::to('deliveryNote/create')->withErrors('The composite key (agreementID, revision, itemID) is not found in DeliveryNoteCategory Table!');
		}
		else 
		{       
            $deliveryNote = DeliveryNote::find($request->dnNo);          
			$deliveryNote->diNo = $request->diNo;
			$deliveryNote->createdDate = $request->createdDate;
			$deliveryNote->status = $request->status;
            $deliveryNote->save();         
            return back()->with('success','Successfully updated delivery note Information!');     
        }         
    }
public function update ( Request $ request ) { $ input = $ request -> all ( ) ; $ rules = array ( 'dnNo' => 'required|numeric' , 'diNo' => 'required|numeric' , 'createdDate' => 'required' , 'status' => 'required' , ) ; $ message = [ 'dnNo.required' => 'Please input the delivery note number' , 'dnNo.numeric' => 'Please input the delivery note number in correct format' , 'diNo.required' => 'Please input the dispatch Instruction number' , 'diNo.numeric' => 'Please input the dispatch Instruction number in correct format' , 'createdDate.required' => 'Please input the created date' , 'status.required' => 'Please input the status' , ] ; $ validator = Validator :: make ( $ input , $ rules , $ messages ) ; if ( $ validator -> fails ( ) ) { return Redirect :: to ( 'deliveryNote/create' ) -> withErrors ( $ validator ) ; } else if ( ! foreignKeyExists ( $ request ) ) { return Redirect :: to ( 'deliveryNote/create' ) -> withErrors ( 'The composite key (agreementID, revision, itemID) is not found in DeliveryNoteCategory Table!' ) ; } else { $ deliveryNote = DeliveryNote :: find ( $ request -> dnNo ) ; $ deliveryNote -> diNo = $ request -> diNo ; $ deliveryNote -> createdDate = $ request -> createdDate ; $ deliveryNote -> status = $ request -> status ; $ deliveryNote -> save ( ) ; return back ( ) -> with ( 'success' , 'Successfully updated delivery note Information!' ) ; } }
Update the specified resource in storage.
Update the specified resource in storage .