1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 05:02:36 +01:00
invoiceninja/app/Jobs/ConvertProposalToPdf.php
2018-03-22 09:31:47 +02:00

26 lines
522 B
PHP

<?php
namespace App\Jobs;
use App\Jobs\Job;
use App\Libraries\CurlUtils;
class ConvertProposalToPdf extends Job
{
public function __construct($proposal)
{
$this->proposal = $proposal;
}
public function handle()
{
$proposal = $this->proposal;
$url = $proposal->getHeadlessLink();
$filename = sprintf('%s/storage/app/%s.pdf', base_path(), strtolower(str_random(RANDOM_KEY_LENGTH)));
$pdf = CurlUtils::renderPDF($url, $filename);
return $pdf;
}
}