IM trying to access PDO (https://packagist.org/packages/slim/pdo) from the container inside my Models but a blank page loads
app.php
$container[‘pdo’] = function ($container) use ($config) {
return new \Slim\PDO\Database($config[‘db’][‘dsn’], $config[‘db’][‘usr’], $config[‘db’][‘pw’]);
};
user.php
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;
}else{
return false;
}
}
}