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