LaravelDaily/laravel-invoices

Custom Templates?

sprklinginfo opened this issue · 2 comments

thank you for the great package. After installation, I see the default template. In the readme, it claims the 'templates' feature. Does it mean we can add custom templates? how to use the new templates? Thanks!

mc0de commented

@sprklinginfo thank you

  1. make sure you have published all assets with php artisan invoices::install
  2. then you can put your templates to resources/views/vendor/invoices/templates

for example resources/views/vendor/invoices/templates/mytemplate.blade.php

  1. and when creating invoice just specify template name
$invoice = Invoice::make()
            ->buyer($customer)
            ->discountByPercent(10)
            ->taxRate(15)
            ->shipping(1.99)
            ->addItem($item)
            ->template('mytemplate');

You can lookup in default template resources/views/vendor/invoices/templates/default.blade.php how certain things are implemented.

terrific! Many thanks.