public function testResource($input, $res)
{
try {
$this->capsule->getConnection($res);
} catch (\Exception $e) {
throw new DBException("Can't connect to target database");
}
if (!empty($input['table'])) {
try {
$this->capsule->getConnection($res)->table($input['table'])->first();
} catch (\Exception $e) {
throw new DBException("Can't access target table");
}
}
}