@Sinnbeck Here is my full implementation
public function fetchInvoices(Request $request)
{
if( $request->ajax() ){
$invoices = Invoices::where('user_id', $request->id)
->get()
->map($invoices, function($invoice){
$invoice->created_at = $invoice->created_at->toDateString();
return $invoice;
});
$totalInvoices= 0.00;
foreach($invoices as $value){
$invoicesTotal += $value->amount;
}
return response()->json([
'user_invoices' => $invoices,
'invoices_total' => $totalInvoices,
], 200);
}
}
And then, in my blade file I am outputting
response.user_invoices.created_at
Since am using javascript on the frontend
My output on the screen however is
2022-12-15t00:00:00.000000z
And I want it to be more readable like
Invoice Created on 15-12-2022 ... and the time...