I'm facing a weird issue in Laravel that I can't figure out. In my controller I fetch several results from a MySQL database. These results are results to a search query that searches in various databases. I shove these results (from the different tables) in an array and return the array.
The error I get is:
The Response content must be a string or object implementing __toString(), "boolean" given.
And is thrown at
vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Response.php#402
Using Barry's DebugBar I've verified that the array is created perfectly fine. All the data I expect is there and I don't see any problems.
Now I would love to show you the array that I return but this sadly is impossible as we're talking about sensitive customer data.
Now this error only sometimes occurs (on certain search words). This would suggest that there is some kind of UTF-8 or quote problem.
How would I start debugging this? What are the possible reasons that Laravel sees my array as a boolean?
Edit: The basic setup of my controller function:
$customers = Customer::where....
$suppliers = Customer::where.....
$products = Customer::where....
$result = array(
'results' => [
'customers' => $customers,
'suppliers' => $suppliers,
'products' => $products,
]
);
return $result;