Support the ongoing development of Laravel.io →
posted 6 years ago

I have this code when displaying list of invoices, this is similar or maybe exactly the same to the ones in the official Laravel Cashier documentation. I am getting this weird DateTime::__construct(): Failed to parse time string (@) at position 0 (@): Unexpected character error and I'm not sure what's the @ character doing in replace of a supposed to be date.

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

Does anyone have a similar experience? I have also tried to just var_dump each $invoice->date() in the controller but the error is still the same. The line $invoice->date()->toFormattedDateString() is causing the error because the invoice date is NULL. I followed the Laravel Cashier Stripe documentation but I am getting this error. When downloading invoices, the error is also the same because the invoice date is NULL.

Last updated 3 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.