I have followed the API tutorial.
I have everything working.
Now I am creating an authentication function that I will call at the beginning of each api call.
Example:
$app->get('/api/robots', function() use ($app) {
$auth_data=is_authorized($app);
...
..
So now in the "index.php" file I have a function titled "is_authorized"
The function runs fine however I cannot execute SQL within this function.
The following example does not execute within the is_authorized function.
$phql = "SELECT * FROM Members ORDER BY id";
$robots = $app->modelsManager->executeQuery($phql);
While the above will run within my initial api call function it does not run in the is_authorized function. Is there a way to pass "$app" to this function so that I can use it to execute queries?