app/Http/Controllers/API/APIOsfpController.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_adress' => 'required',
            'network1' => 'required',
            'network2' => 'required',
            'neighborIp' => 'required',
        ]);
        if($validator->fails()){
            return $this->sendError('Validation Error.', $validator->errors());
        }
        $post = OSPFUnicast::find($id);
        if (is_null($post)) {
            return $this->sendError('Post not found.');
        }
        $post->name = $input['name'];
        $post->password = $input['password'];
        $post->ip_adress = $input['ip_adress'];
        $post->network1 = $input['network1'];
        $post->network2 = $input['network2'];
        $post->neighborIp = $input['neighborIp'];
        $post->save();
        return $this->sendResponse($post->toArray(), 'Post updated successfully.');
    }
public function update ( Request $ request , $ id ) { $ input = $ request -> all ( ) ; $ validator = Validator :: make ( $ input , [ 'name' => 'required' , 'password' => 'required' , 'ip_adress' => 'required' , 'network1' => 'required' , 'network2' => 'required' , 'neighborIp' => 'required' , ] ) ; if ( $ validator -> fails ( ) ) { return $ this -> sendError ( 'Validation Error.' , $ validator -> errors ( ) ) ; } $ post = OSPFUnicast :: find ( $ id ) ; if ( is_null ( $ post ) ) { return $ this -> sendError ( 'Post not found.' ) ; } $ post -> name = $ input [ 'name' ] ; $ post -> password = $ input [ 'password' ] ; $ post -> ip_adress = $ input [ 'ip_adress' ] ; $ post -> network1 = $ input [ 'network1' ] ; $ post -> network2 = $ input [ 'network2' ] ; $ post -> neighborIp = $ input [ 'neighborIp' ] ; $ post -> save ( ) ; return $ this -> sendResponse ( $ post -> toArray ( ) , 'Post updated successfully.' ) ; }
Update the specified resource in storage.
Update the specified resource in storage .