Hello, I have a request from a customer of mine to setup automated reporting that is emailed to a specific group of users that they define. I have the report built and can view on the web and manually export.
From what I can tell the export feature requires a web request to be made via POST. The issue I have is that since this is a multi tenant application I don't have an authenticated user while running the report instead use a method from the tenancy class that loops through the tenants and initializes tenancy.
Is there a different way to build the base64 version of a PDF without forcing a POST request?
I did try this to auth the post request but still runs outside of that scope.
<?php
Auth::login($user);
$this->info(tenant());
$this->info(auth()->user());
//'http://' . $tenant->primary_domain->domain . '.pm3.test/reports/compliance'
$response = Http::asForm()->post($tenant->route('tenant.reports.compliance'), [
'_token' => csrf_token(),
'dateRange' => [now()->subDay()->timezone('America/Los_Angeles'), now()->addDays(90)->timezone('America/Los_Angeles')],
]);
$this->info($response->body());