API reference / Quittio \ Laravel \ Templates
BladeTemplateEngine
final class in quittio/laravel · implements TemplateEngine
Quittio\Laravel\Templates\BladeTemplateEngine · Source
Renders Blade views with the invoice view model as $invoice. The name "default" maps to the configured template. Template names may come from invoice data, so only these views can be selected: the configured template (quittio.pdf.template), the shipped views under "quittio::templates." (no partials) and the views of quittio.pdf.templates ("invoices.*" or "namespace::*" allows every view below a prefix). Names that are no Blade view fall back to the plain PHP templates, which resolve names inside their template directories only (never file paths).
Methods#
| Method | Description |
|---|---|
->__construct() | |
->allows() | |
::fromSettings() | The engine of the configuration: pdf.template for "default" and the views of pdf.templates (a missing key means ['invoices.*'], the views of make:quittio-template). Rendering and the preview use it, so both accept the same views. |
->render() |
__construct()#
public function __construct(
Factory $views,
string $defaultView = 'quittio::templates.default.layout',
PhpTemplateEngine $fallback = new \Quittio\Core\Templates\PhpTemplateEngine(),
list<string> $allowed = [],
)| Parameter | Type | Description |
|---|---|---|
$views | Illuminate\Contracts\View\Factory | |
$defaultView | string = 'quittio::templates.default.layout' | |
$fallback | PhpTemplateEngine = new \Quittio\Core\Templates\PhpTemplateEngine() | |
$allowed | list<string> = [] | further selectable views or "prefix*" patterns |
allows()#
public function allows(string $view): bool| Parameter | Type | Description |
|---|---|---|
$view | string |
- Returns
bool
fromSettings()#
public static function fromSettings(Factory $views, Settings $settings): selfThe engine of the configuration: pdf.template for "default" and the views of pdf.templates (a missing key means ['invoices.*'], the views of make:quittio-template). Rendering and the preview use it, so both accept the same views.
| Parameter | Type | Description |
|---|---|---|
$views | Illuminate\Contracts\View\Factory | |
$settings | Settings |
- Returns
self
render()#
public function render(
string $template,
InvoiceViewModel $invoice,
array $data = [],
): string| Parameter | Type | Description |
|---|---|---|
$template | string | |
$invoice | InvoiceViewModel | |
$data | array = [] |
- Returns
string