Laravel Cashier Invoice Date Issue

Refresh

April 2019

Views

3 time

0

I am using Laravel 5.8 with Laravel Cashier. When I try to show a list of invoices of a user, I used this code:

@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

However, the line $invoice->date()->toFormattedDateString() gives an error:

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

It seems that the Invoice date is null. Are there other settings that I should follow? Downloading the invoice will also produce an error because of the Invoice date.

0 answers