ConsoleTVs/Invoices

error with example

x0rld opened this issue · 5 comments

x0rld commented

image
I tried to use your lib who looks easy to use but there is this error

  • Laravel version?
  • Invoices version?
  • PHP version?
  • Lines of code that causes the failing?
x0rld commented

I don't use laravel I just wanted to use this to do an invoice in php
it's invoice 1.6
i'm on php 7.4
the error is when the function config() is call

    public function __construct($name = 'Invoice')
    {
        $this->name = $name;
        $this->template = 'default';
        $this->items = Collection::make([]);
        $this->currency = config('invoices.currency');
        $this->decimals = config('invoices.decimals');
        $this->logo = config('invoices.logo');
        $this->logo_height = config('invoices.logo_height');
        $this->date = Carbon::now();
        $this->business_details = Collection::make(config('invoices.business_details'));
        $this->customer_details = Collection::make([]);
        $this->footnote = config('invoices.footnote');
        $this->tax_rates = config('invoices.tax_rates');
        $this->due_date = config('invoices.due_date') != null ? Carbon::parse(config('invoices.due_date')) : null;
        $this->with_pagination = config('invoices.with_pagination');
        $this->duplicate_header = config('invoices.duplicate_header');
    }``` 

As you can see, the construct makes use of the config() helper provided by laravel.

This library was created for laravel, not for the PHP ecosystem itself. You can however, try to create a config() function that takes two parameters and just leave it empty. Maybe this will work...

function config($a, $b) {}

Next time check out the description :)

image

Hello! I upgraded as well to 1.6 and I am on laravel. Is there changes in how to set tax. Because I got can't set the tax anymore. I previously used ->tax() but I cant use it anymore. I am at laravel 7.*. I also setted the tax_rates in the invoice config. But I don't want that because tax is different on different products. I also can't use ->tax_rates().

I am getting this error 🧨 Method Illuminate\View\View::__toString() must not throw an exception, caught Facade\Ignition\Exceptions\ViewException: Too few arguments to function ConsoleTVs\Invoices\Classes\Invoice::taxPriceFormatted(), 0 passed in