Access FaaPz/Slim-PDO from container in model


IM trying to access PDO ( from the container inside my Models but a blank page loads

$container[‘pdo’] = function ($container) use ($config) {
return new \Slim\PDO\Database($config[‘db’][‘dsn’], $config[‘db’][‘usr’], $config[‘db’][‘pw’]);

namespace App\Models;

class User extends Model

	protected $table = 'users';

	public function attempt($username,$password)

		$selectStatement = $this->pdo->select()->from($table)->where('username', '=', $username);
		$stmt 			 = $selectStatement->execute();
		$data 			 = $stmt->fetch();
		if ($data) {
        	return true;
        	return false;


I did a stupid mistake.

$this->pdo->select()->from($table)->where(‘username’, ‘=’, $username);
Should be
$this->pdo->select()->from($this->table)->where(‘username’, ‘=’, $username);


Hi rakma.

It looks like I also have a similar problem. Can you show me source code file Model Class and Controller where you use Model User.

Maybe after finished viewing, i can fix code by myself.

Please help me…