laravel-invoicable
laravel-invoicable copied to clipboard
Invoice number / reference does not comply with some countries
Hi
Package seems to work as described, but the reference or invoice number does not comply with may countries as the number should be a continuous number sequence
It would be nice if one was able to provide a 'InvoiceReferenceGenerator' instead of modifying the code directly.
Thanks for opening this issue.
I agree, we should set the InvoiceReferenceGenerator
class in the config and bind it into the container. Can you submit a PR for this?
Hi
I'm really bad in PR... I don't know how to do it :(
I solved the problem like this:
in the config/invoicable.php i added a new key:
'invoice_reference_generator' => \SanderVanHooft\Invoicable\InvoiceReferenceGenerator::class
in the service provider:
$config = $this->app->config['invoicable']; $this->app->bind(InvoiceReferenceGenerator::class, $config['invoice_reference_generator']);
and then in the boot of the Invoice class
$model->reference = app()->make(InvoiceReferenceGenerator::class)->generate();
I also increased the table field: reference to 20