app/Http/Controllers/API/APIv6tunnelController.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();
        $validator = Validator::make($input, [
            'name' => 'required',
            'password' => 'required',
            'ip_address4' => 'required',
            'ip_address6' => 'required',
            'interface' => 'required',
            'tunnel_source' => 'required',
            'tunnelMode' => 'required',
            'tunnelDestinsation' => 'required'
        ]);
        if($validator->fails()){
            return $this->sendError('Validation Error.', $validator->errors());
        }
        $ip6s =Ip6Tunnel::find($id);
        if (is_null($ip6s)) {
            return $this->sendError('Post not found.');
        }
        $ip6s->name = $input['name'];
        $ip6s->password = $input['password'];
        $ip6s->ip_adress4 = $input['ip_address4'];
        $ip6s->ip_address6 = $input['ip_address6'];
        $ip6s->interface = $input['interface'];
        $ip6s->tunnel_source = $input['tunnel_source'];
        $ip6s->tunnelMode = $input['tunnelMode'];
        $ip6s->tunnelDestinsation = $input['tunnelDestinsation'];
        $ip6s->save();
        return $this->sendResponse($ip6s->toArray(), 'Post updated successfully.');
    }
public function update ( Request $ request , $ id ) { $ input = $ request -> all ( ) ; $ validator = Validator :: make ( $ input , [ 'name' => 'required' , 'password' => 'required' , 'ip_address4' => 'required' , 'ip_address6' => 'required' , 'interface' => 'required' , 'tunnel_source' => 'required' , 'tunnelMode' => 'required' , 'tunnelDestinsation' => 'required' ] ) ; if ( $ validator -> fails ( ) ) { return $ this -> sendError ( 'Validation Error.' , $ validator -> errors ( ) ) ; } $ ip6s = Ip6Tunnel :: find ( $ id ) ; if ( is_null ( $ ip6s ) ) { return $ this -> sendError ( 'Post not found.' ) ; } $ ip6s -> name = $ input [ 'name' ] ; $ ip6s -> password = $ input [ 'password' ] ; $ ip6s -> ip_adress4 = $ input [ 'ip_address4' ] ; $ ip6s -> ip_address6 = $ input [ 'ip_address6' ] ; $ ip6s -> interface = $ input [ 'interface' ] ; $ ip6s -> tunnel_source = $ input [ 'tunnel_source' ] ; $ ip6s -> tunnelMode = $ input [ 'tunnelMode' ] ; $ ip6s -> tunnelDestinsation = $ input [ 'tunnelDestinsation' ] ; $ ip6s -> save ( ) ; return $ this -> sendResponse ( $ ip6s -> toArray ( ) , 'Post updated successfully.' ) ; }
Update the specified resource in storage.
Update the specified resource in storage .