-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Closed
Labels
Description
This is not a feature request of a bug. My a lack of skill issue.
I have a laravel API app, and its meant to take a GET ID and use that in a match to get the individual item from Mongo. All my static queries are working ok.
My code is:
$value = (int)$sub_responseItem['value'];
$page = Track::raw(function ($collection) {
return $collection->aggregate(
[['$match' => ['my_id' => $value ]]]
);
});
$response = new MyCollection($page);
My error is:
message": "Undefined variable $value",
"exception": "ErrorException",
"file": "/var/www/html/app/Http/Controllers/api/v1/MyController.php",
"line": 79, (this is the line with $value on it)
If I change this [['$match' => ['my_id' => $value ]]] to this [['$match' => ['my_id' => 1 ]]], it works ok.
And if i do a var_dump($value); I get (int)1
Can anyone see what I am doing wrong?