It currently returns the $ data variable, even if the request does not return results that give me php errors.
Itβs a good habit to initialize the array you are going to build:
$data = array();
If there are no results, you will get an empty array, and then check it in your controller.
Thus, at least a variable is defined, and you will not receive notifications.
source share