app/Http/Controllers/StaffController.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, $id)
    {
        $input = $request->all();                  
		$rules = array ('name' => 'required',
						'contactPerson' => 'required',
						'telephone' => 'required|numeric',
						'address' => 'required',);
		$message = ['name.required' => 'Please input the supplier name',
					'contactPerson.required' => 'Please input the supplier contact Person',
					'telephone.required' => 'Please input the telephone number',
					'telephone.numeric' => 'Please input the telephone number in correct format',
					'address.required' => 'Please input the address in correct format',];
        $validator = Validator::make($input, $rules, $messages);                 
        if ($validator->fails()) {             
            return Redirect::to('supplier/create')>withErrors($validator);        
        } else {       
            $supplier = Supplier::find($id);         
			$supplier->name = $request->name;
			$supplier->contactPerson = $request->contactPerson;
			$supplier->telephone = $request->telephone;
			$supplier->address = $request->address;
            $supplier->save();         
            return back()->with('success','Successfully updated Supplier Information!');     
        }         
    }
public function update ( Request $ request , $ id ) { $ input = $ request -> all ( ) ; $ rules = array ( 'name' => 'required' , 'contactPerson' => 'required' , 'telephone' => 'required|numeric' , 'address' => 'required' , ) ; $ message = [ 'name.required' => 'Please input the supplier name' , 'contactPerson.required' => 'Please input the supplier contact Person' , 'telephone.required' => 'Please input the telephone number' , 'telephone.numeric' => 'Please input the telephone number in correct format' , 'address.required' => 'Please input the address in correct format' , ] ; $ validator = Validator :: make ( $ input , $ rules , $ messages ) ; if ( $ validator -> fails ( ) ) { return Redirect :: to ( 'supplier/create' ) > withErrors ( $ validator ) ; } else { $ supplier = Supplier :: find ( $ id ) ; $ supplier -> name = $ request -> name ; $ supplier -> contactPerson = $ request -> contactPerson ; $ supplier -> telephone = $ request -> telephone ; $ supplier -> address = $ request -> address ; $ supplier -> save ( ) ; return back ( ) -> with ( 'success' , 'Successfully updated Supplier Information!' ) ; } }
Update the specified resource in storage.
Update the specified resource in storage .