Server Error: 500, class Database not found

Hello everyone,
I am using php slim for the first time to build APIs but I encountered an error after hosting it on a shared server. Whenever I make an API call through postman I get the error message below, though my Database class is configured correctly and uploaded to the server as well (location: public_html/api/src/Model/). Please help me
{
“statusCode”: 500,
“error”: {
“type”: “SERVER_ERROR”,
“description”: “Class ‘App\Db\Database’ not found”
}
}
Here is my controller:
namespace App\Controllers;

use App\Db\Database;
use Firebase\JWT\JWT;
use Respect\Validation\Exceptions\NestedValidationException;
use Slim\Psr7\Response;
use Respect\Validation\Validator as v;

class LoginController
{
       public function __construct($data, Response $response)
      {
$validator = v::keySet(
    v::key('username', v::stringType()->notEmpty()->setName('username')->length(2, 100)),
    v::key('password', v::stringType()->notEmpty()->setName('password'))
);

try {
    $validator->assert($data);
} catch (NestedValidationException $e) {
    $response->getBody()->write(json_encode([
        'responseCode' => "13",
        'responseMessage' => $e->getMessages(),
    ]));
    return $response->withHeader('Content-Type', 'application/json');
}

$username = $data['username'];
$password = $data['password'];

$hash_pwd = password_hash($password, PASSWORD_DEFAULT);
$db = Database::getInstance();

$login_query =
    $db->select(
        'users',
        [
            'email_address',
            'passwords'
        ],
        [
            'email_address' => $username,
        ]
    );

if (!$login_query) {
    $response->getBody()->write(json_encode([
        'responseCode' => '99',
        'responseMessage' => "Invalid Login Details"
    ]));
} else {
    $user_hash_pwd = $login_query[0]['passwords'];
    $password_verify = password_verify($password, $user_hash_pwd);
    if ($password_verify) {
        $key = "!@#$%^&*()_+";
        $payload = array(
            "iss" => "http://localhost",
            "aud" => "http://localhost",
            'iat' => time(),
            'uid' => 1,
            'exp' => time() + 10,
        );
        $token = JWT::encode($payload, $key);
        $decoded = JWT::decode($token, $key, array('HS256'));


        $response->getBody()->write(json_encode([
            'responseCode' => '0',
            'responseMessage' => "Logged In",
            'responseBody' => [
                'token' => $token
            ]
        ]));
    } else {
        $response->getBody()->write(json_encode([
            'responseCode' => '99',
            'responseMessage' => "Incorrect password"
        ]));
    }
}

}
}

This is just an autoloading configuration issue. Please show us your composer.json “autoload” section.

For example:

"autoload": {
    "psr-4": {
        "App\\": "src/"
    },
"autoload": {
"psr-4": {
  "App\\": "src/",
  "App\\Db\\": "src/Model/"
   }
  }

The second entry could cause the issue in combination with another namespace. I would try to follow PSR-4 as it is intended. Try to remove the second entry "App\\Db\\": "src/Model/", move the file src/Model/Database.php to src/Db/Database.php and run composer dump-autoload or composer update.

I have been able to solve the problem. I changed the database.php file to Database.php and it worked. Thanks for your responses I really appreciate. Slim is really fun and easy.