<?php
namespace App\Services\Generators;
use Illuminate\Support\Facades\Storage;
use App\Models\Quote;

use Barryvdh\DomPDF\Facade\Pdf;

class PdfGenerator {
	public static function generate(Quote $quote, bool $force = false): array {
		$path = "quotes/{$quote->id}/pdf.pdf";
		if(!$force && Storage::exists($path)) return [0, Storage::get($path)];

		$x = Pdf::loadView('mail.quotepdf', ['quote' => $quote])->output();
		Storage::put($path, $x);
		return [1, $x];
		}
	}
