How to send data from controller to rest api in laravel?

Solution:

You could use the Laravel HTTP Client (which is a wrapper for Guzzle HTTP Client) to perform a request to that API.

use Illuminate\Support\Facades\Http;

$response = Http::post('mydomain.com/api/sync-data', [
    'data' => Data::all(),
    'newdata' => NewData::all(),
]);