@eDesignary I believe the source of this error message is when Laravel tries to convert the $receipts to JSON. What does the $receipts variable looks like? Can you try and post a dd() here?
Please ensure that your database driver is using some kind of utf8 encoding.
@kfirba without receipt_date there is no error. It is working normally when I return the result from joins and normal query, but when I try unionAll I'm getting this error, but it is working with union
@eDesignary When you view your database using the console or some other program, does the data seem to be valid? Does it show the proper date as you expect?
Also, try running the query manually against your database using the console or some other program and see what the returned data looks like.
I'm trying to see where exactly the data corruption is happening.
It might not have anything to do with the problem but I don't see the txn_id field in any of the tables.
Also, do all the items in the collection have the corrupted receipt_date like that? Could you check if they have a correct date before returning them as json?
@ftrillo it is transaction_id not txn_id, edited my question, and it is not the problem. and yes all the items in the collection have the corrupted receipt_date and they are good before returning them as json.