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