Код: Выделить всё
static public function apiRequestWithFile($method, $endpoint, array $params = [], $file = null)
{
$apiKey = env('API_KEY');
$baseUrl = env('BASE_URL');
$file = fopen($file, 'r');
$response = Http::withHeaders([
'Authorization' => $apiKey,
])->attach('file', $file, 'file.csv')
->$method($baseUrl . $endpoint, $params);
return $response->json();
}
Следуя документации laravel

Подробнее здесь: https://stackoverflow.com/questions/777 ... ror-coming