Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

basosneo's avatar

@hajrovica. Well, now I am trying to put the current date and an id to the invoice but I still do not know how it can be done, do you have any idea?

hajrovica's avatar

Ok ... Lets clarify some things

You want to put current date to invoice? Or a date when invoice is created? In my logic useful thing would be date when invoice is created ...

In case of current date you could go for something like:

 {{Carbon\Carbon::now()->toDateTimeString()}}

that will just output current date/time in view, and i am not saying this is good practice though again in my view it is better to print out date related to invoice... For getting date using Eloquent, check https://laravel.com/docs/5.3/eloquent-mutators

About id? what kind of id is it? Number of invoice or something else, i cant say because i do not have larger "view" of app and what is exact approach for managing invoices. If i recall your want to pass $cart variable, retrieved from session, to view? Is that order somehow stored/saved, what if user wants to print some old order and so on ...

Previous

Please or to participate in this conversation.