Error: I need help with MVC

You are giving the following error:
Notice : Undefined variable: app in C:\xampp\htdocs\thesi\admin\services.php on line 6

Fatal error : Uncaught Error: Call to a member function get() on null in C:\xampp\htdocs\thesi\admin\services.php:6 Stack trace: #0 {main} thrown in C:\xampp\htdocs\thesi\admin\services.php on line 6

I do not know how to solve, could someone help me?

Below is the admin folder with the


use Illuminate\Database\Capsule\Manager as Db;
include __DIR__ . '/../vendor/autoload.php';

$db = new Db();

    'driver' => 'pgsql',
    'host' => 'localhost',
    'database' => 'dbescola',
    'username' => 'postgres',
    'password' => 'ana1997',
    'charset' => 'utf8',
    'collation' => 'utf8_unicode_ci',
    'prefix' => ''


include __DIR__ . '/app.php'; //nova linha


use \Psr\Http\Message\ServerRequestInterface as Request;
use \Psr\Http\Message\ResponseInterface as Response;
use Illuminate\Database\Capsule\Manager as Db;

$app->get('/aluno/', function ()  {
    $aluno = Db::table('aluno')->get();
    return json_encode($aluno);


use Illuminate\Database\Capsule\Manager as Db;

$app = new Slim\App;

// autenticação
$app->add(new Tuupola\Middleware\HttpBasicAuthentication([
    "users" => [
        "anam" => "anam",
        "anap" => "anap"

include __DIR__ . "/services.php";


Im a little bit confused her?!.. Your Services.php looks like a route file? If thats the case, I would advice you to change your setup, so that your route calls a method in a controller instead of trying to query the database directly from your route…