Laravel Cashier发票中的日期问题

问题描述 投票:0回答:1

我有这段代码来查看我页面中的所有发票:

@foreach ($user->invoices() as $invoice)
    <tr>
        <td>{{ $invoice->date()->toFormattedDateString() }}</td>
        <td>{{ $invoice->total() }}</td>
        <td>
            <a href="/invoice/{{ $invoice->id }}">Download</a>
        </td>
    </tr>
@endforeach

但是,行$invoice->date()->toFormattedDateString()给出错误:

DateTime::__construct(): Failed to parse time string (@) at position 0 (@): Unexpected character

我只是按照Laravel Cashier(Billing)网站上的所有说明操作,我收到了这个错误。我尝试了两个版本的Laravel(5.8和5.5)和两个Laravel Cashier版本(8.0和7.0)。所有测试都有相同的日期问题。

我添加了正确的迁移字段。这是我插入/添加订阅到我的数据库的方式:

$user = Auth::user();
$user->newSubscription('eat', 'eat_monthly')->create($request->stripeToken);
laravel laravel-cashier laravel-stripe
1个回答
1
投票

而不是{{ $invoice->date()->toFormattedDateString() }}

你能试试{{ $invoice->created_at->toFormattedDateString() }}吗?

© www.soinside.com 2019 - 2024. All rights reserved.