I have two laravel projects.
One of them has an API

I am trying to get data using the API.

```
public function getSyncOrders() {
    $orders = Invoice::where('status', 0)->get();
    return response()->json([
        'data' => [
            'orders'                => $orders
        ]
    ], 200);      
}

```

I am trying to fetch data in the other laravel project.

```
public function syncOrders() {
    if(auth()->check()){
        Order::truncate();

        $curl = curl_init();

        curl_setopt_array($curl, array(
            CURLOPT_URL => "http://project1.net/api/sync-orders",
            CURLOPT_RETURNTRANSFER => true,
            CURLOPT_MAXREDIRS => 10,
            CURLOPT_TIMEOUT => 600,
            CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
            CURLOPT_CUSTOMREQUEST => "GET"
        ));

        $response = curl_exec($curl);
        $err = curl_error($curl);

        curl_close($curl);

        if ($err) {
            //echo "cURL Error #:" . $err;
        } else {
            echo $response;
        }
    }
    else{
        return redirect('/');
    }
}

```

But I get the error :

> 
> SQLSTATE[42S02]: Base table or view not found: 1146 Table
>  'project2.invoice' doesn't exist (SQL: select \* from `invoice`
>  where `status` = 0)
> 
> 
> 

Project 1 has table `invoice` in database while project 2 has table `orders` in database.

If I use the url `http://project1.net/api/sync-orders` in browser, it returns data. 

I need help to fix the curl request so that project 2 doesn't execute code and search in its own database but instead get the data from the API.