Ad
Laravel Invoice Error
Using Laravel 5.2, I'm generating a list of invoices which works fine with the following code:
$owner = User::where("accountId",Auth::user()
->accountId)
->where("owner",1)
->first();
$invoices = $owner->invoices();
However when I try to download the invoice
return $this->owner->downloadInvoice($id, [
'vendor' => 'XXXXXXX',
'product' => 'XXXXXXX',
]);
I get the following error
FatalErrorException in 0aba430056a58a8038d61445deab8578 line 133: Call to undefined method Laravel\Cashier\InvoiceItem::startDateString()
The error seems to be coming from this block in the receipt template, but after an extensive Googling' session I can't seem to find any answers.
<!-- Display The Subscriptions -->
@foreach ($invoice->subscriptions() as $subscription)
<tr>
<td>Subscription ({{ $subscription->quantity }})</td>
<td>{{ $subscription->startDateString() }} - {{ $subscription->endDateString() }}</td>
<td>{{ $subscription->dollars() }}</td>
</tr>
@endforeach
Any ideas?
Ad
Answer
I believe the invoice template was from an older version of Laravel. I've updated the template to this:
@foreach ($invoice->subscriptions() as $subscription)
<tr>
<td>Subscription ({{ $subscription->quantity }})</td>
<td>{{ $subscription->startDate() }} - {{ $subscription->endDate() }}</td>
<td>{{ $subscription->total() }}</td>
</tr>
@endforeach
And it seems to be working
Ad
source: stackoverflow.com
Related Questions
- → "failed to open stream" error when executing "migrate:make"
- → October CMS Plugin Routes.php not registering
- → OctoberCMS Migrate Table
- → OctoberCMS Rain User plugin not working or redirecting
- → October CMS Custom Mail Layout
- → October CMS - How to correctly route
- → October CMS create a multi select Form field
- → October CMS - Conditionally Load a Different Page
- → How to disable assets combining on development in OctoberCMS
- → October CMS - Radio Button Ajax Click Twice in a Row Causes Content to disappear
- → OctoberCms component: How to display all ID(items) instead of sorting only one ID?
- → In OctoberCMS how do you find the hint path?
- → How to register middlewares in OctoberCMS plugin?
Ad