Thursday, March 2, 2017

How to insert into couchDB in laravel

How to insert the records to couchDB in laravel. i have done the retrieval part but now I want to do insert, update and delete .

My retrieval code is below.

class couchdbcontroller extends Controller

{

public function getdata() {
$content =null;

    try { 
            $client = new Client();             

       $apiRequest = $client->request('GET','http://localhost:5984/user/_design/userdesign/_view/user-view?limit=20&reduce=false'); 


        $code = $apiRequest->getBody()->getContents();

    } catch (RequestException $re) {
      //For handling exception
     return $re->error;
    }
    return $code;
    //return response()->json($code);
}}



via Carlos

Advertisement