Level 50
I am not sure if the output() function returns string or base64 or stream.
But, with spatie media library, you also get these functions. One of that should work, depending on what dompdf returns.
$report->addMediaFromString($pdf->output())->toMediaCollection('docs');
// OR
$report->addMediaFromStream($pdf->output())->toMediaCollection('docs');
// OR
$report->addMediaFromBase64($pdf->output(), 'application/pdf')->toMediaCollection('docs');
My bet is on String. https://spatie.be/docs/laravel-medialibrary/v10/api/adding-files#content-addmediafromstring
1 like