Laravel发票错误

时间:2016-02-13 08:59:27

标签: php laravel laravel-5.2 laravel-cashier

使用Laravel 5.2,我正在生成一个发票列表,可以使用以下代码正常工作:

$owner = User::where("accountId",Auth::user()
->accountId)
->where("owner",1)
->first();
$invoices = $owner->invoices();

但是当我尝试下载发票时

return $this->owner->downloadInvoice($id, [
    'vendor'  => 'XXXXXXX',
    'product' => 'XXXXXXX',
]);

我收到以下错误

  

0aba430056a58a8038d61445deab8578第133行:呼叫中的FatalErrorException   未定义的方法Laravel \ Cashier \ InvoiceItem :: startDateString()

错误似乎来自收据模板中的这个块,但在广泛的Google搜索会话后,我似乎无法找到任何答案。

            <!-- 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

有什么想法吗?

1 个答案:

答案 0 :(得分:3)

我认为发票模板来自旧版本的Laravel。我已将模板更新为:

        @foreach ($invoice->subscriptions() as $subscription)
            <tr>
                <td>Subscription ({{ $subscription->quantity }})</td>
                <td>{{ $subscription->startDate() }} - {{ $subscription->endDate() }}</td>
                <td>{{ $subscription->total() }}</td>
            </tr>
        @endforeach

它似乎正在运作

相关问题